What is the output of the following code? class Student implements Cloneable { int id; Student...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
What is the output of the following code? class Student implements Cloneable { int id; Student (int id) { this.id id; } public static void main(String[] args) throws CloneNot SupportedException { Student s1= new Student (9); Student s2 = (Student) si.clone(); s1.id = 18; System.out.println(s1.id+" "+s2.id); } What is the output of the following code? class Student implements Cloneable { int id; Student (int id) { this.id id; } public static void main(String[] args) throws CloneNot SupportedException { Student s1= new Student (9); Student s2 = (Student) si.clone(); s1.id = 18; System.out.println(s1.id+" "+s2.id); }
Expert Answer:
Answer rating: 100% (QA)
The image contains Java code for a class named Student that implements the Cloneable interface The S... View the full answer
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Posted Date:
Students also viewed these programming questions
-
How do you simplify the max method in the following, using the conditional operator? 1: /** Return the max of two numbers */ 2: public static int max ( int num1, int num2 ) { 3: int result; 4: 5: if...
-
What is the output of this code? Explain how did you made the file and provide a pic of the out put. import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class...
-
Marcia Stubern is planning for her golden years. She will retire in 20 years at which time she plans to begin withdrawing 60,000 annually. She is expected to live for 20 years following her...
-
The Southern Economic Journal (Apr. 2008) published a guide to graduate study in economics by ranking the Ph.D. programs at 129 colleges and universities. Each program was evaluated according to the...
-
Use the web to locate the lyrics to the traditional song The Twelve Days of Christmas. The song contains a list of gifts received for the holiday. The list is cumulative so that as each day passes, a...
-
A European recession and the U.S. economy a. In 2014, European Union spending on U.S. goods accounted for \(18 \%\) of U.S. exports (see Table 17-2), and U.S. exports amounted to \(15 \%\) of U.S....
-
Ferraro, Inc. established a share-appreciation rights (SAR) program on January 1, 2010, which entitles executives to receive cash at the date of exercise for the difference between the market price...
-
Suppose your yearly demand for razors is Q = 32 - 4P. There is a subscription service that charges $2.00 per razor plus an annual membership fee. What is the most that you would be willing to pay for...
-
The owner of Neros company has hired you to analyze her company's performance and financial position, as well as the positions of Iits competitors, Centar and Xermix. However, the data Neros abtained...
-
Bon Vivant has just issued bonds whose face value on the market is $200,000. The bonds mature in 10 years and carry an interest rate of 5%. Interest is payable semi annually. The market rate is 4%....
-
7. Nearly 75% of Texas' foreign-born residents are from O South America. O Mexico and Central America. O Europe. O Asia.
-
to IR and which one is best, a)What are the [3marks] busing Naive bayes classifier and laplace smoothing find the classification for the below [4marks] Color Type Origin Stolen? 1 Red Sports Domestic...
-
A perfect gas is compressed from 139 o C and 70.57 cm 3 to 331.6 o C and 50.25 cm 3 with a resulting pressure of 1226.26 kPa gauge. Calculate the initial absolute pressure of the gas in kPa rounded...
-
To use the Vector tool, select the initial point and then the terminal point. +Move -7 -6 -5 Vector -4 -3 -2 7 6 5 4 3 Undo 2 1 -1 0 -1 -2 -3 -4 -5 -6 -7 y 1 2 3 Redo 4 01 5 x Reset 6 7 X
-
The trait approach is primarily O Scripted; Unscripted Directive; Supportive Prescriptive; Descriptive O Evidence-based; anecdotal O Descriptive; Prescriptive while the situational approach is
-
A sinusoidal voltage Av = 35.0 sin(100t), where Av is in volts and t is in seconds, is applied to a series RLC circuit with L = 150 mH, C = 99.0 F, and R = 64.0 Q. (a) What is the impedance (in 2) of...
-
If (x) 0 on the interval [a, b], the definite integral gives the exact area under the curve between x = a and x = b.
-
a. How many levels does the given tree have? b. How many branches does it have, and which nodes are they? c. How many leaves does it have, and which nodes are they? d. Which node is the root of the...
-
When should you use a TreeSet, and when should you use a HashSet?
-
The following code attempts to draw a black-filled outer rectangle with a white-filled inner circle inside it: DrawingPanel panel = new DrawingPanel(200, 100); Graphics g = panel.getGraphics();...
-
You know you have hit the big time when the purple-and orange-lettered Federal Express (FedEx) truck driven by a smiling courier pulls into your driveway or walks up your stairwell and hands you the...
-
Perhaps the most famous case illustrating the enormous cost of winning back lost customers is that of the Tylenol Murders. Seven people in the Chicago area died suddenly after taking Tylenol...
-
Describe the concept of MBWA.
Study smarter with the SolutionInn App