Exercise 09.09 | Java Programming written interview questions

1. If the program code is:
public class Demo {
public static void main (String [] args) {
String A = args [. 1];
System.out.println (A);
After compiling, executing the following command what the results obtained ?
java Demo a1 a2 a3
Results: A2
2, a conventional class defined below, answer the questions:
class the Employee {
String name;
int Age;
Double wage;
static int No = 0;
the Employee (String A1, int A2, A3 Double) {
name = A1; Age = A2; A3 = wage;
No ++;
the use of such, the following statement is used to generate a class of objects:
the Employee E1, E2;
E1 = new new the Employee ( "Jin Wang", 26,6300 );
e2 = new new the Employee ( "Zhang Shan", 30,3800);
the problem:
1) e2.name, e2.age, e2.wage value of all that?
2) generate an object e1, after e2, e1.No how much value can be prefixed properties No references by class name and age?
Results: 1) (Zhang Shan; 30; 3800.0)
2) can be accessed No, you can not access age
3, the reading program, write the operation result of
class Ql {
public static void main (String args []) {
Double D = 1.23;
On Dec On Dec = new new On Dec ();
dec.decrement (D);
System.out.println ( D);
classs On Dec {
public void Decrement (Double decMe) {
decMe = decMe - 0.1;
results: 1.23
4, the analysis results of the implementation of the following program:
class the Value {
public int I = 15;
public class the Test {
public static void main ( the argv String []) {
the Test new new T = the Test (); t.first ();
public void First () {
int I =. 5;
the Value = new new V the Value ();
VI = 25; SECOND (V, I);
System.out.println (VI);
public void SECOND (the Value V, I int) {
I = 0; VI = 20 is;
the Value = new new Val the Value ();
Val = V;
System.out.println (VI + "" + I);
Results: 0 20 is 15
5, the results of the analysis performed in the following procedure:
public class the Test {
public static void main () {
int I =. 1, J = 10;
do {
IF (I ++> --j)
Continue;
} the while (I <. 5);
System.out.println ( "I =" + I + "J =" + J);
results: i = 5, j 6 =

Guess you like

Origin blog.51cto.com/14512197/2436866