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

x. Briefly describe the difference between a class method and an instance method

ID: 3590881 • Letter: X

Question

x. Briefly describe the difference between a class method and an instance method. xi. In the statement System.out.println("hello, world!");, explain what System xii. Briefly describe the difference between the stack and the heap in our memory model. xii. Briefly describe the four sections of the memory model discussed in class: stack, heap, out and println each are. data segment, code segment. xiv. What is "this" in Java? xv. Briefly describe the two uses of this in a constructor. xvi. Briefly describe what an activation record is and what it is used for. xvii. Java provides eight primitive wrapper classes. Explain what they are. xvii. Strings are immutable in Java. What does this mean? xix. Can a Java class have no constructors? (Explain yes or no.) xx, Given String s = new String("cat"); and String t = "cat"., draw the box & arrow diagram for these two variables

Explanation / Answer

Answer x)

Answer xi)

System : It is basically a final class that contians objects which encapsulates standard I/o devices

Out : It is a static member field of System class which represents output stream.

println : It is a mrthod of PrintStream class. It prints the arguments passed to standard console/monitor screen.

Answer xii)

Answer xiv) A stack is basically the one in which the satic memory allocation is done which means that the variables allocated on stack are stored directly to the memory thus making the memory access quicker and faster whereas in heap the memory allocation is done dynamically i.e. at the run time therefore the variables allocated memory on heap are allocated their memory at runtime and makes it slower to have access to that memory.

A data segments is basically the ones in which the global variables and the static variables which are initialized by the programmer are stored. The data segment is read-write as the variables can be altered at run time.

Code segment is also known as Text Segment. It contains executable instructions. It can be shared .

Instance Methods Class Methods Require an object of its class to be created before it can be called Called without creating an instance of the class Can be operated on specific instances of classes Can be operated on class members