Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java Questions Object References: You use a null reference to indicate that an object variable (reference) does not refer to any object. Of course, you
Java Questions
Object References: You use a null reference to indicate that an object variable (reference) does not refer to any object. Of course, you cannot invoke methods on a null reference since there is no object to which the method would apply. Consider this program segment: String str null; System.out.println (str) str.length) System.out.println (str) 1. What problem arises when executing these statements? Do the statements produce any printout beyond an error message? If so, what printout? (2 points) 2. Explain why it would be a poor decision to make instance data public instead of private. Give an example of why this could result in a problem. (2 points)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started