1. What can you say about the name of a class? ___ It must start with an upperca
ID: 3664925 • Letter: 1
Question
1. What can you say about the name of a class?
___ It must start with an uppercase letter.
___ The convention is to start with an uppercase letter.
2. What can you say about the name of constructors?
___They must be the same name as the class name.
___ The can be the other name, just like other methods.
3. What is a constructor’s return type?
___ void
___ Object
47. In the main method of the class GradeClient, you have coded.
Grade g = new Grade( ‘B’ ); g.letterGrade = ‘A’; //line10
When you compile, you get the following message:
GradeClient.java:10: error letter grade has private access in Grade
g.letterGrade = ‘A’; //line10
^
1 error
Explain what the problem is and how to fix it.
48. In the main method of the class GradeClient, you have coded
Grade g = new Grade ( “A” ); //line 10
When you compile, you get the following message:
GradeClient.java:10: error: incompatible types: String can not be convert to char
Grade g = new Grade ( “A” ); //line10
^
Note: Some messages have been simplifies; recompile with
-Xdiags:verbose to get full output
1 error
Explain what the problem is and how to fix it.
Explanation / Answer
1.It must start with an upper case letter
2.They must be same name as class name
3.void
47.If you try to access the private class of another class java will not recognize so it will through an error
use extension class
48.It is an unchecked error,
and also it overrides
It is an warning only
try to compile again and check it will work
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.