Consider the following program written in Java using a notepad to answer questions 7 - 9.
class MySelf{
private String name;
private int age;
MySelf(){}
MySelf(String a, int b){ name = a; age = b;}
public void setName( String n) {name = n;}
public void setAge( int a) { age = a;}
public void display(){ System.out.println(name + " " + age);}
}
public class DriverPro{
public static void main(String args[]){
MySelf singer= new MySelf("Whitney Houston", 38);
MySelf leader= new MySelf();
leader.display();
}
}
7) After saving the program by giving the file name MySelf.java, what is the output when compiled
using the following command?
javac MySelf.java
(a) MySelf.class (b) MySelf.java
(c) Myself.java (d) DriverPro.class
(e) error
8) After saving the program by giving the file name DriverPro.java, what would the output be when
compiled by using the following command?
javac DriverPro.java
(a) MySelf.class (b) MySelf.java
(c) Myself.java (d) DriverPro.class
(e) error
class MySelf{
private String name;
private int age;
MySelf(){}
MySelf(String a, int b){ name = a; age = b;}
public void setName( String n) {name = n;}
public void setAge( int a) { age = a;}
public void display(){ System.out.println(name + " " + age);}
}
public class DriverPro{
public static void main(String args[]){
MySelf singer= new MySelf("Whitney Houston", 38);
MySelf leader= new MySelf();
leader.display();
}
}
7) After saving the program by giving the file name MySelf.java, what is the output when compiled
using the following command?
javac MySelf.java
(a) MySelf.class (b) MySelf.java
(c) Myself.java (d) DriverPro.class
(e) error
8) After saving the program by giving the file name DriverPro.java, what would the output be when
compiled by using the following command?
javac DriverPro.java
(a) MySelf.class (b) MySelf.java
(c) Myself.java (d) DriverPro.class
(e) error

