Question: (a) There are two ways to insert comments into a Java program. What are they, and what are their advantages and disadvantages? (10 marks] (b)

(a) There are two ways to insert comments into a Java program. What are they, and what are their advantages and disadvantages? (10 marks] (b) In Java, a non-void method must have a return instruction somewhere in the body. But a situation can arise where the Java compiler complains that a return instruction is needed, even when the method already contains one. Why does this happen and how do you resolve the problem? [10 marks] (c) What is the difference between an internal and an external method call? In what situation would only internal calls be needed? [10 marks] d) If a method given an ArrayList as a parameter calls a second method giving it the same ArrayList, and that second method deletes one of the elements, will this change be visible in the first ArrayList? Explain your answer. [10 marks] e) How are static variables and methods created in Java? What happens if a non- static method of a class tries to access a static variable of that class? What happens if a static method references a non-static variable? What happens to the static variables of a class once the class has no instances? [10 marks]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
