Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Currently doing a past paper. Please can I have solutions to compare with. Thanks Question 1 a) Explain the lifecycle of an applet [10] b)

Currently doing a past paper. Please can I have solutions to compare with. Thanks
Question 1
a) Explain the lifecycle of an applet [10]
b) Inthe following program , explain why the value 6" is printed twice in a row:
classPrePostDemo {
publicstaticvoidmain(String[ ]args){
inti = 3;
i++;
System.out.println(i); //"4"
++i;
System.out.println(i); //"5"
System.out.println(++i); //"6"
System.out.println(i++); //"6"
System.out.println(i); //"7"
}
} [5]
c) Explain the implications of using the following access modifiers:
i) Private [5]
ii) Protected [3] and
iii) Public [3]
Question 2
a) Debug the following interface
PublicinterfaceSomethingIsWrong { voidaMethod(intaValue) {
System.out.println("HiMom");
}
}
b) Explain the following ObjectOriented Programming terms
i) Polymorphism;
ii) Encapsulation; and
iii) Object Overloading.
p
c) Write a program that computes your initials from your full name and displays them. [10]
Question 3
a) Describe the parts that make up OOP [10]
b) Recall the Pythagorean Theorem says that if a; b are the lengths of two
edges of a right triangle, then the length of the hypotenuse c is given by
c2 = a2 + b2:
Write a Java application which prompts the user to enter the lengths of two edges of a right triangle and then computes the length of the hypotenuse. [15]

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

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions