• Post Reply 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jdk versions

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried to run the following program in ubuntu 11.04 using jdk6.0 and windows vista using jdk 7.0 and got two different outputs:
class M
{
static
{
System.out.println("SIB");
}
}
for jdk 6.0 the output was : SIB
from main exception
for jdk the output was: from main exception

For some programs the output was same in both the jdks but not in this one
 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Saptarshi Talukdar wrote:I tried to run the following program in ubuntu 11.04 using jdk6.0 and windows vista using jdk 7.0 and got two different outputs:

for jdk 6.0 the output was : SIB
from main exception
for jdk the output was: from main exception

For some programs the output was same in both the jdks but not in this one



Java program without writing main method is allowed in JDK 6 but not in 7(especially for standalone java app.)...

Just go through the following an many others(you can search on javaranch):
https://coderanch.com/t/407661/java/java/we-write-java-program-without
https://coderanch.com/t/471679/java/java/run-normal-java-program-without
https://coderanch.com/t/407561/java/java/Do-Java-program-run-without
https://coderanch.com/t/406107/java/java/Program-without-main-method
https://coderanch.com/t/383115/java/java/JAVA-program-run-without-main
 
Blood pressure normal? What do I change to get "magnificent"? Maybe this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic