public class thread {
public static void main(String[] args) {
mythreadprog my1 = new mythreadprog("demo");
// mythreadprog my2 = new mythreadprog("demo2");
}
}
class personal_details
{
String name,mname,lname,course;
int roll_no;
void add_details()
{
name= "chirag";
mname="n";
lname="Shah";
roll_no= 136;
course = "Msc";
}
void print_details()
{
System.out.println(name);
System.out.println(mname);
System.out.println(lname);
System.out.println(roll_no);
System.out.println(course);
}
}
class mythreadprog implements Runnable
{
personal_details p1= new personal_details();
String threadname;
Thread t;
mythreadprog (String name)
{
threadname = name;
t= new Thread(this,"Mydemo");
//System.out.println(t);
t.start();
}
public void run()
{
p1.print_details();
}
}