IITDU Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

print hello world without main method in java

3 posters

Go down

print hello world without main method in java Empty print hello world without main method in java

Post by BIT0112-Rokon 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!!
BIT0112-Rokon
BIT0112-Rokon
Programmer
Programmer

Course(s) :
  • BIT

Blood Group : O+
Posts : 673
Points : 1269

http://blog.codexplo.org

Back to top Go down

print hello world without main method in java Empty Re: print hello world without main method in java

Post by aswani44 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

Back to top Go down

print hello world without main method in java Empty Re: print hello world without main method in java

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

??
BIT0112-Rokon
BIT0112-Rokon
Programmer
Programmer

Course(s) :
  • BIT

Blood Group : O+
Posts : 673
Points : 1269

http://blog.codexplo.org

Back to top Go down

print hello world without main method in java Empty Re: print hello world without main method in java

Post by aswani44 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

Back to top Go down

print hello world without main method in java Empty Re: print hello world without main method in java

Post by BIT0112-Rokon 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 ...
BIT0112-Rokon
BIT0112-Rokon
Programmer
Programmer

Course(s) :
  • BIT

Blood Group : O+
Posts : 673
Points : 1269

http://blog.codexplo.org

Back to top Go down

print hello world without main method in java Empty Re: print hello world without main method in java

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

Rokon, please ensure that people use the code tag when giving codes ^_^
BIT0122-Amit
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

https://iitdu.forumotion.com

Back to top Go down

print hello world without main method in java Empty Re: print hello world without main method in java

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

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