Day 2: Java Notes

 Day 2: Java Notes 



Access one class properties in another class with in the same package:


Eg. program:


Package org.employee;


Public class Employee{

Public void empId(){

system.out.println(“emp id is 102”);

}

Public void empName(){

system.out.println(“emp name is jeba”);

}

}

—--------------------


Package org.company;

Public class Company{

Public void companyId(){

system.out.println(“ company id is s234”);

}

Public void companyName(){

system.out.println(“company name is Wipro”);

}

Public static void main( String[] args)

{

Company c= new Company();

c.companyId();

c.companyName();

Employee e = new Employee();

e.empId();

e.empName();

}


Assignment:


QUESTION 1:

------------

     Project   :LanguageDetails

     Package   :org.lang


     Class     :LanguageInfo

     Methods   :tamilLanguage(),englishLanguage(),hindiLanguage()


     Class     :StateDetails

     Methods   :southIndia(),northIndia()


Description:

Create an object for LanguageInfo and StateDetails  inside the StateDetails class and call both classes methods also follow the all coding standards.



QUESTION 2:

-------------

     Project   :PhoneDetails

     Package   :org.phone

     Class     :ExternalStorage

     Methods   :size()


     Class     :InternalStorage

     Methods   :processorName(),ramSize()


Description:

Create an object for ExternalStorage and InternalStorage inside the InternalStorage class and call both classes methods also follow the all coding standards.\



Access on class properties in another class from another package:


Package org.employee;


Public class Employee{

Public void empId(){

system.out.println(“emp id is 102”);

}

Public void empName(){

system.out.println(“emp name is jeba”);

}

}

—-----------------


Package org.client;

// import packageName.ClassName;

Import org.employee.Employee;

Public Class Client{

Public void clientId(){

system.out.println(“client id is 345”);

}

Public void clientName(){

system.out.println(“client name is citi”);

}

Public static void main(String[] args)

{

Client c- new Client();

c.clientId();

c.clientName();

Employee e= new Employee();

e.empId();

e.empName();

}





Assignment:


QUESTION 1:

--------------

     Project   :TransportInformation

     Package   :org.transport

     Class     :Transport

     Methods   :TransportForm

     

     Package   :org.road

     Class     :Road

     Methods   :bike(),cycle(),bus(),car()


     Package   :org.air

     Class     :Air

     Methods   :aeroPlane(),heliCopter()


     Package   :org.water

     Class     :Water

     Methods   :boat(),ship()


Description:

Create an object for all 4 classes  inside the Transport class and call all classes methods also follow the all coding standards.   



QUESTION 2:

--------------

     Project   :NetworkInformation

     Package   :org.network

     Class     :Wifi

     Methods   :wifiName()


     Class     :MobileData

     Methods   :dataName()


     Class     :Lan

     Methods   :lanName()


     Class     :Wireless

     Methods   :modamName()


Description:

Create an object for all 4 classes  inside the Wifi class and call all classes methods also follow the all coding standards.


Comments

Popular posts from this blog

Inheritance and Type of Inheritance

DAY 1: Java Course Notes

Interview Topics for Software Testers and QA