Question: in Java: Write a class Student that has a firstName, lastName, id, mobilePhone and a count. Declare the count as a static variable. The count

in Java:

Write a class Student that has a firstName, lastName, id, mobilePhone and a count.

Declare the count as a static variable.

The count is incremented every time an object of this class is created.

Write the default constructor, a constructor that takes parameters: firstName, lastName, id and mobilePhone.

Write a third constructor that takes only firstName and lastName.

Write the set and get methods for your attributes.

Make sure that the phone number consists of 10 numbers and that the first name and last name consist of more than 2 characters.

Create a function that displays all the student information and another that displays only the name.

Then write a demo program that tests the methods of your Student class.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!