Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ii. In a Java program, why does main need to be public? iii. Give a concise defi

ID: 3919823 • Letter: I

Question

ii. In a Java program, why does main need to be public? iii. Give a concise definition of abstract data type. Use the definition from class. iv. Briefly describe the differences between a stack and a queue v. Briefly describe what a final class and what a final method are vi. Give a concise definition of a method signature. What is the method signature of the toString and equals methods from the Object class? vii. What is the difference between a primitive data type and a reference data type? viii. Briefly describe the difference between a class attribute and an instance attribute ix. Briefly describe the difference between a class method and an instance method x. Briefly describe the four sections of the memory model discussed in class: stack, heap, data segment, code segment xi. Briefly describe the differences between the "is-a" and "has-a" relationship of classes. xii. Briefly describe the difference between an abstract class and a concrete class. xiii. Briefly describe the differences between an abstract class and an interface.

Explanation / Answer

SOLUTION:-

(ii) :- In a Java program, main method need to be public in order to be make it available from outward of that class via access modifier "public" defined by Java. If main method will be public then it is comfortably available and executed by JVM(Java Virtual Machine).

(iii):- A type or class with respect to objects those actions are determined through group of values and functioning and describes only those actions which will be executed but does not provide their implementation details, is called abstract data type.

(iv):- Stack is an objects group which defines object's approachability in Last In First Out sequence (LIFO) and It provides the functionality of addiiton, deletion and searching of data values through uppermost position in the stack.

Queue is an objects group which defines object's approachability in First In First Out sequence(FIFO). It provides the functionality of addiiton,deletion through last and uppermost position respectively and facilitates the searching of next data values.

(v):- If a method will be declared as "final" then it can not be overridden because a derived class can not contain identical method signature along with distinct implementation.

If a class will be declared as "final" then it can not be inherited through any different class. Abstract classes are not allowed to be declared as "final" if and only if it will be stated as an abstract class.

======================================================================