Solved

I have to create a class in a java code

Posted on 2014-12-09
3
115 Views
Last Modified: 2014-12-09
I know nothing in java and I have to:

Create a class 'Child' which inherits 'Parent'
0
Comment
Question by:Serra David Thomas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
Radek Baranowski earned 500 total points
ID: 40488543
public class Parent {
int Age;
String gender;
public Parent(String gen,int ag){
this.Age = ag;
this.Gender = gen;
}
}

public class Child extends Parent {
String birthDate;

public Child(String gen,int ag, String bd){
super(gen,ag);
this.birthDate=bd;
}
}

Open in new window


Pretty much it.

place both classes in separate files named Parent.java and Child.java

anything more specific you need ?
0
 

Author Comment

by:Serra David Thomas
ID: 40488555
It's working.
Thank you
0
 
LVL 11

Expert Comment

by:Radek Baranowski
ID: 40488557
np. happy to help
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Java: anonymous class 4 54
Java Eclipse Loop 3 46
restrict decimal places for double datatype 10 49
maven not picking latest jar instead picking old jar from .m2 12 74
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This video teaches viewers about errors in exception handling.
Suggested Courses

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question