Jtest

更新时间:2023-05-16 04:36:10 阅读: 评论:0

Java 2 TEST
Question: 1长寿花的养殖方法和注意事项
Given the following code:
class Test{
五笔打字法自学的方法      private int m;
      public static void fun() {
qq邮          //
      }
}
How can the member variable m be accessible directly in the method fun()?
A. change private int m to protected int m
B. change private int m to public int m
C. change private int m to static int m
D. change private int m to int m
Explanation:
If the variable m is changed to be a static variable it can be accessible in the method fun() for this method is a static member method.
Correct Answer: C 1 of    60
   
 
Question: 2
Which methods are correct overloading methods of the following method:
public void example(){...}
A. public void example( int m){...}
B. public int example(){...}
C. public void example2(){...}
D. public int example ( int m, float f){...}
Explanation:
The overloading methods must have the same names. If only the return type of the methods are different it is sufficient tell the methods from each other. The arguments of the methods must be different enough to determine which method to call.
Correct Answer: A,D 2 of    60
好想牵住你的手
   
 
Question: 3
Given the following fragment of code:
public class Ba{
    int w, x, y ,z;
    public Ba(int a,int b){
          x=a; y=b;
          }
    public Ba(int a, int b, int c, int d){
          // assignment x=a, y=b
        w=d;
          z=c;
          }
      }
Which expressions can be ud at the point of // assignment x=a, y=b?
A. Ba(a,b);
B. x=a, y=b;
C. x=a; y=b;
D. this(a,b);
Explanation:
In the cond constructor, the call this(a,b) pass control the version of the constructor that takes two int arguments.
Correct Answer: C,D 3 of    60
   
 
Question: 4
Given the following definition:
拳法            String s = "story";
幼儿园学期总结
      Which of the following expressions are legal?
A. s += "books";
B. char c = s[1];
C. int len = s.length;
D. String t = s.toLowerCa();
Explanation:
Answer B is not correct for String is a class and can'T be treated as an array of char. Answer C is not correct for s.length() should be ud, not s.length.
Correct Answer: A,D 4 of    60
   
 
Question: 5
What is the return value of the main() method in Java?
A. String
B. int
C. char
D. void
Explanation:
The main() method in Java returns void.
Correct Answer: D 5 of    60
   
Question: 6
黄瓜种植
Which are the valid identifiers in Java?
A. fieldname
B. super
C. 3number
D. #number
E. $number
Explanation:
Valid identifiers in Java can start with a letter, underscore (_), or dollar sign ($), but not with digits or other signs. And identifiers can not be keywords.
Correct Answer: A,E 6 of    60
   
Question: 7
Which are valid Java keywords?
A. const
B. NULL
C. fal
D. this
E. native
Explanation:
All the keywords in Java are lowerca. goto and const are keywords that are not ud in Java programming language.
Correct Answer: A,C,D,E 7 of    60
   
 
Question: 8
Which are valid integral expressions in Java?
A. 22
B. 0x22
C. 022
D. 22H
Explanation:
In Java integral has three forms: decimal, octal and hexadecimal. Octal values start with a zero and hexadecimal values start with 0x.
Correct Answer: A,B,C 8 of    60
   
 
Question: 9
Which one of the following ranges of short is correct?
Explanation:
The length of the short data is 16 bits. The range of short is
The length of the short data is 16 bits. The range of short is
Correct Answer: D 9 of    60
   
Question: 10
Which one of the following ranges of byte is correct?
Correct Answer: B 10 of 60
   
Question: 11
Given the following fragment of code, what are results of  i and j after execution?
int i = 1;
int j;
j = i++;
A. 1, 1
B. 1, 2
C. 2, 1
D. 2, 2
Explanation:
Pay attention to the position of the operator ++.  In this question, first j is assigned to 1, then the value of i is added to 2.
可是你没有Correct Answer: C 11 of    60
   
 
Question: 12
Which of the following statements are true?
A. >> is the arithmetic right shift operator.
B. >> is the logical right shift operator.
C. >>> is the arithmetic right shift operator.
D. >>> is the logical right shift operator.
Explanation:
There are two right shift operators in Java. They are >> and >>>. >> is the arithmetic(signed) right shift operator and >>> is the logical(unsigned) right shift operator.

本文发布于:2023-05-16 04:36:10,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/89/902231.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:方法   养殖   总结   黄瓜   学期
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图