multiple inhertence
package start;
class A
{
protected void a() //a method in A
{
System.out.println("Class A");
}
}
class B extends A
{
public B()
{
super();
}
public void a()
{
super.a();
System.out.println("Class B"); //A's a method overridden in B
}
}
class C extends B
{
public void a() //B's a method overridden in C
{
super.a();
System.out.println("Class C");
}
}
public class M
{
public static void main(String arg[])
{
//Creating a oblect of C
C oC=new C();
oC.a();
//My Question = How to call A's in main an dont wanna print B an C???
}
}
View Answers
February 4, 2011 at 2:57 PM
Hi Friend,
Try this:
class A {
protected void a(){
System.out.println("Class A");
}
}
class B extends A {
public B() {
super();
}
public void a(){
super.a();
System.out.println("Class B");
}
}
class C extends B {
public void a(){
super.a();
System.out.println("Class C");
}
}
public class M {
public static void main(String arg[]){
A a=new A();
a.a();
}
}
Thanks
February 4, 2011 at 3:30 PM
thks for the ans sir but u change the object creation in main class but i just want ti know that there is any way to call class without creating its object in main class,please give the ans sir
Related Tutorials/Questions & Answers:
multiple inhertencemultiple inhertence package start;
class A
{
protected void a() //a method in A
{
System.out.println("Class A");
}
}
class B extends A
{
public B()
{
super
multiple inhertencemultiple inhertence package start;
class A
{
protected void a() //a method in A
{
System.out.println("Class A");
}
}
class B extends A
{
public B()
{
super
Advertisements
multiple inheritance.multiple inheritance. hello,
can java support
multiple inheritance???
hi,ADS_TO_REPLACE_1
java does not support
multiple inheritance
multiple inheritancemultiple inheritance Class A extends Class B but Class A also inherit Super Class Object so it is
multiple inheritence give reason in support of your answer
multiple inheritancemultiple inheritance why java doesn't support
multiple inheritance? we can achieve this by using interface but not with classes? what is the main reason that java community implemented like
Multiple InheritanceMultiple Inheritance Why Java Doesn't have
Multiple Inheritance It is Advantage or Disadvantage.........
Hi Friend,
When we extends... and inconsistencies Java does not support
Multiple Inheritance.
Thanks
Multiple InheritanceMultiple Inheritance All are saying java doesn't support
multiple inheritance but by default Object class is super class for all the user defined... class so java any how do
multiple inheritance? Can you please explain
multiple select values multiple select values can you provide an example for
multiple select values for html:select tag
Remove multiple elements in arraylist Remove
multiple elements in arraylist how can we remove
multiple values in arrayList?
only remove method we used for single remove.but i want to delete
multiple value in arrayList
multiple choice questionsmultiple choice questions how can i store 10
multiple choice questions in one class with using java language
multiple choice questionsmultiple choice questions how can i implement the program to store
multiple questions in class with using core java concepts
select tag multiple values select tag
multiple values I want to insert
multiple values in database which i have selected from select tag
query regarding multiple selectquery regarding
multiple select i have a select in jsp with
multiple options.When i select
multiple values i am not able to insert it into database and how do i retrieve them..please help me with an example code
multiple choice questions programmultiple choice questions program how can i implement the program to store 10
multiple choice questions in one class to develop a oneline quiz with using java language
multiple choice questions programmultiple choice questions program how can i implement the program to store 10
multiple choice questions in one class to develop a oneline quiz with using java language
multiple inheritance - Java Beginnersmultiple inheritance Why java does not support
Multiple Inheritance? First of all the question is wrong the correct one is.........
Q)why java classes does not support
Multiple Inheritance?
JAVA CLASSES ONLY
Data from multiple ResultSets?Data from
multiple ResultSets? hello,
How can I get data from
multiple ResultSets?
Hi,ADS_TO_REPLACE_1
You can iterate the ResultSet separately and get the required data.
Thanks
Multiple File Upload in PHPMultiple File Upload in PHP Hi,
I am beginner in PHP scripting language. I am very interested to learn PHP application. So, can anyone explain or provide related reference about how to
Multiple file upload in PHP.
Thanks
multiple records on same panelmultiple records on same panel i have
multiple access of records and i want to display all of them at one panel.Each time a new panel opens for a keyrecord , i want just to show records on same panel or frame, whatever u can
multiple fields in hashtablemultiple fields in hashtable Hai,could anyone help me to implement the object car fields speed,make & color in Hash table
TO connect multiple databaseTO connect
multiple database How to connect several database from a single application in java depending upon the user input it will connect to that database
Reading multiple xml filesReading
multiple xml files How can we read many xml files from a folder? The same procedure as that of "listfiles
Multiple implementaion of datepicker.Multiple implementaion of datepicker. Hello Sir
I am using date-picker in my web page. But i need to put date-picker on
multiple text fields... function:
$('.calendar').datepicker();
Using it that way for
multiple calendar
autocomplete displaying multiple fieldsautocomplete displaying
multiple fields How can I create an autocomplete with three field (name, id, phone). Placing the phone field in the appropriate input field but selecting the name field into the 'calling' input box
multiple language selectionmultiple language selection Hi how can i do a java program using swing that changes the language like malayalam/tamil etc with languages on a drop down menu
Using criteria for multiple tablesUsing criteria for
multiple tables How to join more than three tables,those tables must be maintain primary key relation ship using Hql criteria & projections
Using criteria for multiple tablesUsing criteria for
multiple tables How to join more than three tables,those tables must be maintain primary key relation ship using Hql criteria & projections
Multiple upload - JSP-ServletMultiple upload Hello everyone and Deepak
i am using jsp and mysql
I am using the program published on roseindia.net of
Multiple upload and i am facing an error as given below please help and reply soon this is my 8th
multiple language support iPhonemultiple language support iPhone Is it possible to create an application in iPhone that can support
multiple languages.
Yes, iPhone/iPad applications support the multi language applications. To create your iPhone
Upload and Download multiple filesUpload and Download
multiple files Hello Sir/Madam,
I need a simple code for upload and download
multiple files(it may be image,doc and txt)which has to be store in database and also retrieve the file from database
sendRedirect to multiple linkssendRedirect to
multiple links hello ,
In my servlet page , i'm using
response.sendRedirect("http://ubaid.tk/sms/sms.aspx?uid="+fromNumber+"&... the above line. i want redirect to
multiple links simultaneously. anyone help me
iPhone SDK Multiple UIButtoniPhone SDK
Multiple UIButton In my iphone SDK program.. i wanted to create
multiple UIButton programatically. I know how to create button and i have... requirement is to create
multiple UIButton's according to number of items available
Creating Multiple ArrayList Creating
Multiple ArrayList I want to create
multiple ArrayList .
import java.util.*;
class ArrayListNames{
public static void main(String args[]){
//here i want to create 10 arraylists of type string
distributed tensorflow multiple gpudistributed tensorflow
multiple gpu Hi,
I am beginner in Data...:
distributed tensorflow
multiple gpu
Try to provide me good examples or tutorials links so that I can learn the
topic "distributed tensorflow
multiple Criteria with Multiple Tables - HibernateCriteria with
Multiple Tables I am using Hibernates Criteria.
How to get Joins using Criteria?
e.g. instead of below query i want to use criteria then How i can?
select
user
from
TeamsUserEntity