早教吧 育儿知识 作业答案 考试题库 百科 知识分享

关于java一些题目,1.Whatdoesthefollowingstatementdoif(s1.compareTo(s2)<0)x=4;Setsxto4ifs2comesbefores1inalphabeticorder.Setsxto4ifs1comesbefores2inlexigraphicorder.Setsxto4ifs1comesbefores2inalphabetic

题目详情
关于java一些题目,
1.What does the following statement do
if (s1.compareTo(s2) < 0)
x = 4;
Sets x to 4 if s2 comes before s1 in alphabetic
order.
Sets x to 4 if s1 comes before s2 in lexigraphic
order.
Sets x to 4 if s1 comes before s2 in alphabetic
order.
Sets x to 4 if s2 comes before s1 in lexigraphic
order.
2.是非题
The values of an enumeration behave much like named
constants - and the same naming conventions are used.
True
False
3.When does it make sense to use a switch statement instead
of an if-else statement?
a.When a multiway if-else statement has many possible
outcomes and the choice is based on an integer or a
character.
b.When a multiway if-else statement has one possible
outcome and the choice is based on an float or a
double.
c.When a multiway if-else statement has many possible
outcomes and the choice is based on an float or a
double.
d.When a multiway if-else statement has one possible
outcome and the choice is based on an integer or a character.
4.
Which of the following assigns the enum value A to rating
given the following code:
enum MovieRating {E,A,B}
MovieRating rating;
a.rating = MovieRating.A;
b.rating = A;
c.rating = "A";
d.rating = 'A';
▼优质解答
答案和解析
2、false
3、C
4、C
介于我的外语成绩借助了翻译工具,第一天我实在是觉得翻译的我看不懂,其他的正确率我不能保证,这能帮到这里了