Professional Documents
Culture Documents
Java Assignments
Java Assignments
Java Assignments
Output:
This is my TATA Motors 1000000
This is my Balance 10000
3.Make use of super class method which is overriden in child class using super
keyword.
A. public class ClassA {
public void getText(String Xyz,int Money){
Xyz="Balance";
Money=10000;
System.out.println("This is my "+Xyz+" "+Money);
}
public static void main(String[] args){
ClassA map=new ClassA();
String Name = "Srisaiteja";
int Balance = 100000;
map.getText(Name,Balance);
}
}
5. When we have parent and child relationship between two classes and when we
create the child class object(without parameters), which constructor will be called
(from child class and parent class )? Write the simple example to demonstrate on
this step by step.
A. public class Person {
String name;
int age;
public Person() {
System.out.println("This is no Parameterized Constructor in Parent
Class");
}
6.When we have parent and child relationship between two classes and when we create
the child class object(with parameters), which constructor will be called(from
child class and parent class )? Write the simple example to demonstrate on this
step by step.
A.
public class Person {
String name;
int age;
public Person(String name, int age) {
this.name = name;
this.age = age;
System.out.println("This is Two Parameterized Constructor");
}
public String getName() {
return name;
}