Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(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)

image text in transcribed

(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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

Students also viewed these Databases questions