Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create class called LabOne with attribute x = 1 2 - Create object of the class LabOne called object 1 and print the value of

Create class called LabOne with attribute x=12- Create object of the class LabOne called object1 and print the value of attribute x3- Create another attribute called y=2 and object called object24- Print the value of both x and y using this format x=1,y=25- Use object1 to change the value of attribute x x=3. Using setter method.6- Declare y as constant by using final.Note that :In Java, when final keyword is used with a variable of primitive data types(int, float, .. etc), value of the variable cannot be changed.7- Create static method called staticMethod, add print statement Static.Call this method from main method.Note that: A static method can be called directly from the class, without having to create aninstance of the class.8- Create public method called publicMethod, add print statement Public.Call this method from main method.9- Create public method called name with String parameter s.Add print statement inside the method ("My name is "+ s)Call the method with your name from main method.10- Create constructor of the class LabOne and create new attribute z.Use constructor to set the value of z z=4.Print the value of z from the main method.11- Create static method called number that takes integer parameter x and return value.Call this method from main method.12- Create another class in the same file called LabOne2.Add method called sum that takes two integer and print the sum of it.Call the method from class LabOne.13- Create an abstract class called Vehicle which attributes V_ID and V_name. The class has methodcalled getName and another abstract method called getID.

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

More Books

Students also viewed these Databases questions