Skip to content

Instantly share code, notes, and snippets.

@anton0xf
Created February 22, 2013 08:56
Show Gist options
  • Select an option

  • Save anton0xf/5011886 to your computer and use it in GitHub Desktop.

Select an option

Save anton0xf/5011886 to your computer and use it in GitHub Desktop.
public class Main {
String variable;
public static void main(String[] args) {
System.out.println("Hello World!");
B b = new B();
}
public Main(){
printVariable();
}
protected void printVariable(){
variable = "variable is initialized in Main Class";
}
}
class B extends Main {
String variable;
public B(){
System.out.println("variable value = " + variable);
}
protected void printVariable(){
variable = "variable is initialized in B Class";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment