there are three way to initialization value to variable 
method
constructor 
using reference variable
given the example  code

Using the referee variable to initialization 
class t{

 int id=1000;
 String name;
}
class s{
public static void main(String[] args) {


t p=new t();

System.out.println("id of student is "+p.id);
System.out.println("id of student is "+p.name);

p.id=100;
p.name="Muhammad Waseem Haider Hacker";
System.out.println("id of student is "+p.id);
System.out.println("id of student is "+p.name);
}
}


Initialization value using the method 
class t{

 int id=1000;
 String name;
}
class s{
public static void main(String[] args) {


t p=new t();

System.out.println("id of student is "+p.id);
System.out.println("id of student is "+p.name);

p.id=100;
p.name="Muhammad Waseem Haider Hacker";
System.out.println("id of student is "+p.id);
System.out.println("id of student is "+p.name);
}
}
initialization value using the constructor

class t{

 int id;
 String name;

 t(int s,String n){
  id=s;
  name=n;

 }
 public void disp(){
  System.out.println(id);
  System.out.println(name);
 }
}
class s{
public static void main(String[] args) {


t p=new t(399,"Waseem Haider");
p.disp();



}
}