Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why is this simple program dispalying compile error?

 
Vishal Hegde
Ranch Hand
Posts: 1077
Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

 
Vishal Hegde
Ranch Hand
Posts: 1077
Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its running now sorry my syntax mistake, but i didnt get one thing. How come static block of app is displayed ,as i have saved it in Exe.java


and using javac Exe.java for compiling
and

java Exe to run it.


I was thinking that static blocks shouldnt run but in this case it is why so??
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Static blocks are run when the class is loaded - which it will be when class App is used in class Exe.
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the compiler errors; they are pretty straight forward:
Line 6 has one character too many, and line 13 is missing one.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic