Consider the following sequence of instructions in java in


a) Consider the following sequence of instructions in Java. In the table below, state what each and every variable contains before or after each statement is executed.

intj=2;
intk=5;
intm=3+2*4;
double v = 1.0 / 2.0;
v=k/2.0;
m=k/j;
k=k%m;
v=m+j;

b) In Object-oriented programming, what is the difference between a class and an object? Provide a real world example to support your answer.
c) Explain, with the aid of an example and a diagram, the difference between an object and an object variable.
d) In addition to a body of a method, there are three other parts to a method definition. Name each of these parts.
e) What general name is given to the method that initialises an object's data members when an object is instantiated?
f) One of the powerful features of OOP is "encapsulation". Describe the meaning of this term and its benefits.
g) Explain how you can achieve encapsulation in the Java programming language.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Consider the following sequence of instructions in java in
Reference No:- TGS01249316

Expected delivery within 24 Hours