Home > Back-end >  Please answer the Java problem
Please answer the Java problem

Time:10-07

For bosses to help explain the code "Wxl wxl1;" Why can write

CodePudding user response:

This is an object, use class to create, one class can create thousands of objects

CodePudding user response:

reference 1st floor well drainage replies:
this is an object, use class to create the same class can create countless objects

With WXL WXL=new WXL (); What's the difference?

CodePudding user response:

Wxl Wxl=new Wxl (); This is to define a variable WXL and let it refers to the new object out
Wxl wxl1; This is just a simple definition of a variable wxl1
Wxl1=WXL; This is to get the variable reference wxl1 and WXL the referenced object, namely wxl1 like WXL, refer to the new object,

CodePudding user response:

Wxl is your definition of a class, in other words, a custom of a more complex data types.
If use the simple data types to describe, believe you understand more, in the following
Int a=0;
int b;
B=a;

Simple data types can direct assignment, and to create objects and instantiate must use the new keyword.
These are basic syntax!

CodePudding user response:

Wxl wxl1; This is to declare a Wxl class name is wxl1
Wxl wxl1=new Wxl (); This is the statement after a Wxl class and call the constructor Wxl (), for Wxl class initialized
, if it is the first approach is not initialized to declare classes, at this time, if you call Wxl inside any method, or called Wxl in any attribute, is not possible (complains, no initialization), if this time to the program interrupt point view Wxl parameters, you will find this time wxl1=null, there is no any attribute,
But an uninitialized Wxl can perform wxl1=Wxl; Where one has been initialized or has been operating Wxl classes assigned to the uninitialized,

CodePudding user response:

Wxl wxl1; This is to declare a Wxl class, the name is wxl1, but he is null;

CodePudding user response:

Java strictly case-sensitive, uppercase and lowercase letters is not the same letters
  • Related