Explore BrainMass

Java Class and Attribute Mixed Questions

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

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

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

3. 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?

4.What is the value of s2:

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

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

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

7. 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?

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

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

© BrainMass Inc. brainmass.com October 25, 2018, 9:38 am ad1c9bdddf

Solution Preview

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

answer: when a class has a constant attribute that can be accessed by anyone, then
you could make the constant attribute public.

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

answer: it is a way to use the same method name with a different method signature which is determined
by the number of the method parameters, the types of the parameters and the order of the ...

Solution Summary

The solution briefly answered 9 simple questions about basic Java use, touching on strings, protected vs. private and more.

See Also This Related BrainMass Solution

productivity based solutions

Microsoft has expended a lot of effort into developing productivity tools for the Web, particularly with the .NET strategy. However, there are many other tools for creating Web solutions, eg. PHP, ColdFusion etc... The .NET strategy is extremely comprehensive, and yet there is always the continuing us versus Microsoft argument. Discuss the merits of adopting such an approach as a business strategy, and do you think it's wise given the enormous productivity gains offered by the .NET solutions? Compare any other productivity based solutions you may have come across in your readings.

Must provide all references.

View Full Posting Details