print hello world without main method in java
3 posters
Page 1 of 1
print hello world without main method in java
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!!
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!!
Re: print hello world without main method in java
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
- Course(s) :
- N/A
Blood Group : NULL
Posts : 2
Points : 2
Re: print hello world without main method in java
- 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
- Course(s) :
- N/A
Blood Group : NULL
Posts : 2
Points : 2
Re: print hello world without main method in java
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 ...
Re: print hello world without main method in java
Rokon, please ensure that people use the code tag when giving codes ^_^
Similar topics
» Java Main Method
» Need help to print Jpanel (with components) in java
» printf method in Java
» Write a Swap method in Java
» Java Tutorial: Using Two Java Reference Keywords, this and super
» Need help to print Jpanel (with components) in java
» printf method in Java
» Write a Swap method in Java
» Java Tutorial: Using Two Java Reference Keywords, this and super
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|
Tue Sep 29, 2015 2:45 pm by Sophiawood
» Cisco EHWIC SFP/GE WAN Card
Mon Sep 07, 2015 11:08 am by Sophiawood
» Huawei S1700-28GFR-4P-AC Price
Thu Jun 25, 2015 2:31 pm by Sophiawood
» teach yourself C++ / Herbert Schildt Solutions
Wed Jun 03, 2015 1:52 pm by Abdullah Al Noman
» teach yourself c by herbert schildt pdf
Wed May 13, 2015 11:01 pm by Raquib Ridwan
» ASA 5506X With Firepower ASA5506-K9
Fri Apr 10, 2015 4:31 pm by Sophiawood
» New Trends in Deal Business
Tue Feb 03, 2015 9:38 pm by nersoa
» PoE Power Allocation for WS-C2960S-24PS-L
Wed Nov 05, 2014 11:12 am by Sophiawood
» How to cure back pain
Fri Oct 31, 2014 7:15 pm by Bergen Guildford