Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
 class test{
public static void main(String args[]){
b ref=new b();
ref.x=99;
ref.show();
}}
class a{
int x=10;}
class b extends a{
void show(){
a ref=new a();
System.out.println(super.x);}} class test{
public static void main(String args[]){
b ref=new b();
ref.x=99;
ref.show();
}}
class a{
int x=10;}
class b extends a{
void show(){
a ref=new a();
System.out.println(super.x);}}


What I have tried:

i want someone to explain code
Posted
Updated 5-Apr-18 21:53pm

Advice:
Learn to indent properly your code, it show its structure and it helps reading and understanding. It also helps spotting structures mistakes.
Java
class test{
  public static void main(String args[]){
    b ref=new b();
    ref.x=99;
    ref.show();
  }
}
class a{
  int x=10;
}
class b extends a{
  void show(){
    a ref=new a();
    System.out.println(super.x);
  }
}
class test{
  public static void main(String args[]){
    b ref=new b();
    ref.x=99;
    ref.show();
  }
}
class a{
  int x=10;
}
class b extends a{
  void show(){
    a ref=new a();
    System.out.println(super.x);
  }
}

Professional programmer's editors have this feature and others ones such as parenthesis matching and syntax highlighting.
Notepad++ Home[^]
ultraedit[^]
-----
This code will not compile because you pasted the same code 2 times.
The debugger is a tool that allow you to execute your code line by line and to inspect all variables as the program pause.
The debugger is an incredible learning tool, but you_ have to give it a try.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900