When should an attribute of a class be static


Discuss the below:

Q1. Is there ever a reason to have a public attribute in a class?

Q2. What does it mean for a method to be overloaded?

Q3. Is it true or false that every class should have a toString( ) method that returns a String which is a text representation of the object. The method is not sent any actual. Is the toString( ) method overridden?

Q4.What is the value of s2:

String s1 = new String( "2 late 2 drop" );
String s2 = s1.substring( 3, 6 );

Q5. Is it true or false that the toUpperCase( ) method of the String class is a mutator?

Q6. When should an attribute of a class be static?

Q7. Is it true or false that if a method within a class is static, then the method can be called without an instance of the class?

Q8. What two access specifier keywords can be used to encapsulate attributes and behaviors within a class?

Q9. Is it true or false that inheritance creates an "is-a" relationship between classes?

Solution Preview :

Prepared by a verified Expert
JAVA Programming: When should an attribute of a class be static
Reference No:- TGS01934149

Now Priced at $25 (50% Discount)

Recommended (97%)

Rated (4.9/5)