Home > Back-end >  [Java learning small white] what is this
[Java learning small white] what is this

Time:09-16

What is the reason for the error in your code???


Package cn. Zshen. Obj.

Public class TestConstructor1 {
Public static void main (String [] args) {
The User zshen=new User (" shenzhong, "" qwerty890");
System. The out. Println (zshen. Name + "" + zshen. PWD).

The User yzhang=new User (" zhangyue ", "asdfgh890", 0818); 0818//there's a problem, why not!!!!!!!!!!!!!!!!!!!!
System. The out. Println (yzhang. Id);
}
}

The class User {
String name;
String PWD;
Int id;

Public User () {

}

Public User (String name, String PWD) {
this.name=name;
Enclosing the PWD=PWD;
}

Public User (String name, String PWD, int id) {
this.name=name;
Enclosing the PWD=PWD;
this.id=id;
}
}

CodePudding user response:

Int cannot begin with 0, change the String type

CodePudding user response:

Oh oh thank you.

CodePudding user response:

Int starting with 0 represents 8 hexadecimal, while the octal number 0818, appeared more than 7 figures did not carry, so literal error

CodePudding user response:

Regardless of the code, count your life began from 01, or starting from 1? I mean, normal circumstances
  • Related