+ 3
What is error in my code??
9 Antworten
+ 9
D.H.Baroliya : Solution 🤗🙆♂️ 💗
Write some pseudo code.
+ 8
D.H.Baroliya: Just happened a problem with Java Compiler at Sololearn ! 😞😟😰😬🤤😨☹😯🙁
https://www.sololearn.com/discuss/1478429/?ref=app
+ 7
D.H.Baroliya : Solution 🤗🙆♂️ 💗
https://code.sololearn.com/cztn50ekCgZS/?ref=app
+ 5
D.H.Baroliya : Solution with main function at end of the program 🤗🙆♂️ 💗
https://code.sololearn.com/cP2uKKP4RhV6/?ref=app
+ 3
sorry i can not understand properly
+ 2
but why we need to write main function at starting 0f the program
+ 2
hmmm
I try the program in notpad at that time my code is properly run any thing is wrong in sololearn with java compiler
+ 1
Cambia de posicion a la clases Main y ponla en primer lugar
class Main{
public static void main(String args[])
{
B obj=new B(10,20);
obj.call();
}
}
class A
{
int no;
void disp()
{
System.out.println("super class method called");
System.out.println("value of no in super class is:"+no);
}
}
class B extends A
{
int no;
B(int a,int b)
{
no=a;
super.no=b;
}
void disp()
{
System.out.println("base class method called");
System.out.println("value of no in base class is:"+no);
}
void call()
{
disp();
super.disp();
}
}
+ 1
In this code i want to eliminate the void call method from the class B and write the method call disp(); and super.disp(); in the main method can i write and if yes and how can i write plz tell me
class A
{
int no;
void disp()
{
System.out.println("super class method called");
System.out.println("value of no in super class is:"+no);
}
}
class B extends A
{
int no;
B(int a,int b)
{
no=a;
super.no=b;
}
void disp()
{
System.out.println("base class method called");
System.out.println("value of no in base class is:"+no);
}
void call()
{
disp();
super.disp();
}
}
class Main
{
public static void main(String args[])
{
B obj=new B(10,20);
obj.call();
}
}