CONCEPT:- We want to save data securely,
INTERVIEW QUESTION FOR JAVA
Java program for EMPLOYEE DETAILS
Java program for MULTIPLE THREADS ACCESSING ONE METHOD
Java program for SINGLE THREADS ACCESSING ONE METHOD
Java program for Strin Reverse
java Program for Twin Prime numbers
JAVA PROGRAM FOR EQUILATERAL TRIANGLE
JAVA PROGRAM FOR RIGHT ANGLE TRIANGLE
JAVA PROGRAM FOR SORTING OF ARRAY MINIMUM TO MAXIMUM WITHOUT USING SORTING METHOD
Java Program for Sorting Of Array Maximum to Minimum WITHOUT USING SORTING METHOD
JAVA PROGRAM FOR TO PRINT PRIME NUMBERS
JAVA PROGRAM FOR FIZZBIZZ , FIZZ BIZZ TEST
Requirements:
1.local variable defined as a public
2.Setter it is used to controller shift to the variables
3. Getter it is used to return the value to a constructor
4. we got the getter value,we did not understand,we need to value converted,so we use toString
5.whether Entered data is correct or not as per stored data at the time we write logic
public public boolean equals(Object obj)
6.we want access object Employee e2=(Employee)obj;
see example easily Understand :
public class Employee
{
private int id;
private String firstname;
private String lastname;
private String fathername;
public Employee(int id,String firstname,String lastname,String fathername)
{
this.id=id;
this.firstname=firstname;
this.lastname=lastname;
this.fathername=fathername;
}
public void setId(int id)
{
this.id=id;
}
public void setFirstname(String firstname)
{
this.firstname=firstname;
}
public void setLastname(String lastname)
{
this.lastname=lastname;
}
public void setFathername(String fastname)
{
this.fathername=fathername;
}
public int getId()
{
return id;
}
public String getFirstname()
{
return firstname;
}
public String getLastname()
{
return lastname;
}
public String getFathername()
{
return fathername;
}
public String toString()
{
return id+":"+firstname+":"+lastname+":"+fathername;
}
public boolean equals(Object obj)
{
Employee e2=(Employee)obj;
if(id==e2.id&&firstname.equals(e2.firstname)&&lastname.equals(e2.lastname)&&fathername.equals(e2.fathername))
return true;
else
return false;
}
public static void main(String[] args)
{
Employee e1=new Employee(222,"udaykiran","g","mallesh");
Employee e2=new Employee(222,"udaykiran","g","mallesh");
Employee e4=new Employee(222,"udaykiran","g","mallesh");
boolean a=e1.equals(e2);
Employee[] employees={e1,e2,e4};
for(Employee e:employees)
{
int id=e.getId();
String fi=e.getFirstname();
String la=e.getLastname();
String fa=e.getFathername();
System.out.print(id);
System.out.println("\t"+fi);
System.out.println("\t"+la);
System.out.println(fa);
}System.out.println(e4);
System.out.println(a);
}
}
INTERVIEW QUESTION FOR JAVA
Java program for EMPLOYEE DETAILS
Java program for MULTIPLE THREADS ACCESSING ONE METHOD
Java program for SINGLE THREADS ACCESSING ONE METHOD
Java program for Strin Reverse
java Program for Twin Prime numbers
JAVA PROGRAM FOR EQUILATERAL TRIANGLE
JAVA PROGRAM FOR RIGHT ANGLE TRIANGLE
JAVA PROGRAM FOR SORTING OF ARRAY MINIMUM TO MAXIMUM WITHOUT USING SORTING METHOD
Java Program for Sorting Of Array Maximum to Minimum WITHOUT USING SORTING METHOD
JAVA PROGRAM FOR TO PRINT PRIME NUMBERS
JAVA PROGRAM FOR FIZZBIZZ , FIZZ BIZZ TEST
Comments
Post a Comment