Home > Back-end >  For a Java basic knowledge
For a Java basic knowledge

Time:10-05

I just learn Java is a two week beginner, there is a topic makes me hard, for help, thank you,

Directly on the code

class Student {
.
Public the Teacher the Teacher getNum () {
.
}
.
}

Class the Teacher {
.
.
}

Class, please the Teacher in the Student getNum what should () method returns, the previously defined again again? For help

CodePudding user response:

For help, the WWW

CodePudding user response:

Public the Teacher getNum () {
.
}
Definition is returned must be an object of the Teacher or null

CodePudding user response:

The class Student {
.
Public the Teacher getNum () {
.
}
.
}

The Class the Teacher {
.
.
}


Is the upper class, to paraphrase the following class, what does this method should return, return;


CodePudding user response:

Don't sink w w w

CodePudding user response:

The return type of a method according to your definition of a return type to return, if you define the return type is a string, is in defining methods must return "" (or return null); If you define a return type for the fixed type, you need to return to return new the Teacher () in the corresponding type (or Null); Return type is defined according to you to return,

CodePudding user response:

reference 3 floor flower sakura sake く RisuG response:
, that is, the upper class, to paraphrase the following class, what does this method should return, return;


The Teacher is that you want to return type, application is not complete because of you, I guess it is according to the serial number of the teachers to return to the complete information of the Teacher,

CodePudding user response:

See the methods defined what type of return is what kind of

CodePudding user response:

Send all your code, you send the code, you return the Teacher class of an object,
  • Related