Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//Using java language programming The question is: 1 class 00P1 7 class name same as constructor name 3 4 private static irt x 3; 4

//Using java language programming image text in transcribed
image text in transcribed
The question is:
image text in transcribed
1 class 00P1 7 class name same as constructor name 3 4 private static irt x 3; 4 private int y II static variable II instance variable 6 public 00P1 (int yy) 7 /I constructor 10 II static method 11 12 13 14 public static void xDisplay() System.out.println(x); l/ displays 3 /I instance method 16 public void yDisplay() 17 18 19 20 ) System.out.println(y); Figure 6.1 (continues) 22 class Testo0P1 23 24 public static void main(String[] args) 25 26 27 28 29 30 00P1 mnew 00P1 (20) I declare m and create object 31 32 /I call before creating objects 00P1.xDisplay (); 00P1 n; n new 00P1 (10); /I declare reference n II create object n.yDisplay) m.yDisplay (); /I displays 10 /I displays 20 34 35 h Figure 6.1 (continued) 10. Move the main method in the Test00P1 class in Fig. 6.1 into the 00P1 class. Delete the Testo0P1 class. Now the complete program is in the 00P1 class. Enter javac 00P1 java 00P1 Does the new program work the same way the original program works? In the new program, only main and x are initially available because they are static. main creates the n and m objects as in the original program and then proceeds as in the original program. The only difference is that main is now in the 00P1 class

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_2

Step: 3

blur-text-image_3

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

User Defined Tensor Data Analysis

Authors: Bin Dong ,Kesheng Wu ,Suren Byna

1st Edition

3030707490, 978-3030707491

Students also viewed these Databases questions

Question

2. Why does email facilitate straight talk?

Answered: 1 week ago

Question

6. Why does what I can say matter more than how I say it?

Answered: 1 week ago

Question

What are the stages of project management? Write it in items.

Answered: 1 week ago

Question

why do consumers often fail to seek out higher yields on deposits ?

Answered: 1 week ago

Question

5. Describe the relationship between history and identity.

Answered: 1 week ago