print hello world without main method in java

View previous topic View next topic Go down

print hello world without main method in java

Post by BIT0112-Rokon on Thu Feb 11, 2010 9:47 am

Guys,
can you write a java program which print "hello world" but there will be no main method in you program..? 

You may seem, Im going to be mad, but fact is that, I've already written a java program which can print something without having main method.
Better try.. 


cheers!!

_________________________________________________________________


Code Explosion Blog | Code Explosion Wiki | The Rokonoid | নির্ঝরিণী
avatar
BIT0112-Rokon
Programmer
Programmer

Course(s) :
  • BIT

Blood Group : O+
Posts : 673
Points : 1269

View user profile http://blog.codexplo.org

Back to top Go down

Re: print hello world without main method in java

Post by aswani44 on Mon Nov 15, 2010 12:52 pm

bit0112-rokon wrote:Guys,
can you write a java program which print "hello world" but there will be no main method in you program..? 

You may seem, Im going to be mad, but fact is that, I've already written a java program which can print something without having main method.
Better try.. 


cheers!!

aswani44
Pre-Alpha Release
Pre-Alpha Release

Course(s) :
  • N/A

Blood Group : NULL
Posts : 2
Points : 2

View user profile

Back to top Go down

Re: print hello world without main method in java

Post by BIT0112-Rokon on Mon Nov 15, 2010 1:20 pm

??

_________________________________________________________________


Code Explosion Blog | Code Explosion Wiki | The Rokonoid | নির্ঝরিণী
avatar
BIT0112-Rokon
Programmer
Programmer

Course(s) :
  • BIT

Blood Group : O+
Posts : 673
Points : 1269

View user profile http://blog.codexplo.org

Back to top Go down

Re: print hello world without main method in java

Post by aswani44 on Mon Nov 15, 2010 1:24 pm

Code:
public class PrintHello{
    static{
system.out.println("Hello");
System.exit(0);
}
}


Last edited by BIT0122-Amit on Mon Nov 15, 2010 5:28 pm; edited 1 time in total (Reason for editing : please use the code tag when giving codes.)

aswani44
Pre-Alpha Release
Pre-Alpha Release

Course(s) :
  • N/A

Blood Group : NULL
Posts : 2
Points : 2

View user profile

Back to top Go down

Re: print hello world without main method in java

Post by BIT0112-Rokon on Mon Nov 15, 2010 2:29 pm

aswani44 wrote:public class PrintHello{
static{
system.out.println("Hello");
System.exit(0);
}
}

nice, nice work.
The post was given, when I was learning Java first time, and it was something really funny and interesting ....
btw thanks ...

_________________________________________________________________


Code Explosion Blog | Code Explosion Wiki | The Rokonoid | নির্ঝরিণী
avatar
BIT0112-Rokon
Programmer
Programmer

Course(s) :
  • BIT

Blood Group : O+
Posts : 673
Points : 1269

View user profile http://blog.codexplo.org

Back to top Go down

Re: print hello world without main method in java

Post by BIT0122-Amit on Mon Nov 15, 2010 5:29 pm

Rokon, please ensure that people use the code tag when giving codes ^_^

_________________________________________________________________
Adminship / Moderatorship is not about power, it is about Responsibility.

|About me|My Blog|
avatar
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

View user profile http://iitdu.forumsmotion.com

Back to top Go down

Re: print hello world without main method in java

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum