Interesting problem:
Change if statement and print out "Hello World"
public static void main(String[] args) {
if(){
System.out.println("Hello");
}else{
System.out.println("World");
}
}
My solution is to add "!System.out.println("Hello")" in the if statement,But it doesn't work, any ideas?
public static void main(String[] args) {
if(!System.out.println("Hello")){
System.out.println("Hello");
}else{
System.out.println("World");
}
}
UPDATE: I think this works:
public static void main(String args[]) {
if(System.out.append("Hello ")==null){
System.out.print("Hello ");
}else{
System.out.println("World");
}
}
In C:
main()
{ if(printf("Hello"),0)
printf("Hello");
else
printf(" world!\n");
getch();
}
Tadaaaa:
public static void main(String args[]) {
if(!new Object() {
public boolean foo() {
System.out.print("Hello ");
return true;
}
}.foo()){
System.out.println("Hello");
}else{
System.out.println("World");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With