Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

static and initialization block

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
class Bird
{System.out.println("b1");
public Bird(){System.out.println("b2");
}
class Raptor extends Bird
{
static{System.out.println("r1");}
public Raptor(){System.out.println("r2");}
{System.out.println("r3");}
static{System.out.println("r4");}
}

class Hawk extends Raptor
{
public static void main(String s[])
{
System.out.println("pre");
new Hawk();
System.out.println("hawk");
}
}

can you please tell me when exaclty is the class loaded in the memory and after which statement
 
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Similar question
 
Marshal
Posts: 79699
381
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Originally posted by James Tharakan:
Similar question



Agree. Shall close this thread.

Vini Singh: Please read this FAQ, and this one.
 
The harder you work, the luckier you get. This tiny ad brings luck - just not good luck or bad luck.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
    Bookmark Topic Watch Topic
  • New Topic