Tuesday, February 23, 2010

Удамшил жишээ src


// ajluulahdaa
// javac lab01.java
// java lab01 Bat Dondog

class Student {
public String Ovog;
public String Ner;

Student (String ovog, String ner){
Ovog=ovog;
Ner=ner;
}

Student (String ovog){
Ovog=ovog;
}

public String getOvog()
{
return Ovog;
}
public String getNer()
{
return Ner;
}
}

class hwStudent extends Student{
private String location;
hwStudent(String OVOG, String NER, String BAIRSHIL)
{ super(OVOG,NER);
location=BAIRSHIL;
}
public String getLocation()
{System.out.println("Bi "+location+" suudag.");}

}
public class lab01 {
public static void main (String args[]){

Student oyutan= new Student (args[0], args[1]);
Student bagsh= new Student ("Cecgee");
hwStudent oyutan2= new hwStudent("Bat","Dorj","3n Davkhar");

System.out.println("Oyutan: "+oyutan.getOvog()+" "+oyutan.getNer());
System.out.println("Bagsh: "+oyutan.getOvog()+" "+bagsh.getOvog());
System.out.println("HW oyutan: "+oyutan2.getOvog()+" "+oyutan2.getLocation());

}
}

No comments:

Post a Comment