Skip to main content
added 911 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

Java 78, 376376 361 bytes

v->{System.\u006Fut.p\u0072int\u006Cn("He\u006C\u006C\u006F... eh, \u0077h\u006Fm sh\u006Fu\u006C\u0064 I g\u0072eet?");System.\u006Fut.p\u0072int\u006Cn(ne\u0077 java.uti\u006C.Scanne\u0072(System.in).next().equa\u006CsIgn\u006F\u0072eCase("\u0077\u006F\u0072\u006C\u0064")?"Ah, yes. \u0057\u006F\u0072\u006C\u0064.":"N\u006F. That isn't \u0077hat I meant.");}
v\u006Fi\u0064 c(){System.\u006Fut.p\u0072int\u006Cn("He\u006C\u006C\u006F... eh, \u0077h\u006Fm sh\u006Fu\u006C\u0064 I g\u0072eet?");System.\u006Fut.p\u0072int\u006Cn(ne\u0077 java.uti\u006C.Scanne\u0072(System.in).next().equa\u006CsIgn\u006F\u0072eCase("\u0077\u006F\u0072\u006C\u0064")?"Ah, yes. \u0057\u006F\u0072\u006C\u0064.":"N\u006F. That isn't \u0077hat I meant.");}

-15 bytes switching from Java 7 to 8.

Try it online.

Explanation:

In Java you can use unicode escapes in the form of \u####. Fortunately, u wasn't one of the disallowed characters, so I've used these unicode escapes for the characters that are disallowed.

void c(){System.out.println("Hello... eh, whom should I greet?");System.out.println(new java.util.Scanner(System.in).next().equalsIgnoreCase("world")?"Ah, yes. World.":"No. That isn't what I meant.");}
v->{                            // Method with empty unused parameter & no return
  System.out.println("Hello... eh, whom should I greet?");
                                //  Print the greetings line
  System.out.println(new java.util.Scanner(System.in).next()
                                //  Get the user input from STDIN
    .equalsIgnoreCase("world")? //  If it's equal to (case-insensitive) "world":
      "Ah, yes. World."         //   Print the World-response line
    :                           //  Else:
      "No. That isn't what I meant.");}
                                //   Print the No-response line

Which don't need any further explanationTaking the input as parameter and returning a String instead of using STDIN/STDOUT (which I think.

is allowed reading the challenge again, so not sure why I hadn't done that four years ago when I posted my answer), it would be Test code:239 bytes instead:

s->"He\u006C\u006C\u006F... eh, \u0077h\u006Fm sh\u006Fu\u006C\u0064 I g\u0072eet?\n"+(s.equa\u006CsIgn\u006F\u0072eCase("\u0077\u006F\u0072\u006C\u0064")?"Ah, yes. \u0057\u006F\u0072\u006C\u0064.":"N\u006F. That isn't \u0077hat I meant.")

Try it here.Try it online.

class M{
  v\u006Fi\u0064 c(){System.\u006Fut.p\u0072int\u006Cn("He\u006C\u006C\u006F... eh, \u0077h\u006Fm sh\u006Fu\u006C\u0064 I g\u0072eet?");System.\u006Fut.p\u0072int\u006Cn(ne\u0077 java.uti\u006C.Scanne\u0072(System.in).next().equa\u006CsIgn\u006F\u0072eCase("\u0077\u006F\u0072\u006C\u0064")?"Ah, yes. \u0057\u006F\u0072\u006C\u0064.":"N\u006F. That isn't \u0077hat I meant.");}

  public static void main(String[] a){
    new M().c();
  }
}

Java 7, 376 bytes

v\u006Fi\u0064 c(){System.\u006Fut.p\u0072int\u006Cn("He\u006C\u006C\u006F... eh, \u0077h\u006Fm sh\u006Fu\u006C\u0064 I g\u0072eet?");System.\u006Fut.p\u0072int\u006Cn(ne\u0077 java.uti\u006C.Scanne\u0072(System.in).next().equa\u006CsIgn\u006F\u0072eCase("\u0077\u006F\u0072\u006C\u0064")?"Ah, yes. \u0057\u006F\u0072\u006C\u0064.":"N\u006F. That isn't \u0077hat I meant.");}

Explanation:

In Java you can use unicode escapes in the form of \u####. Fortunately, u wasn't one of the disallowed characters, so I've used these unicode escapes for the characters that are.

void c(){System.out.println("Hello... eh, whom should I greet?");System.out.println(new java.util.Scanner(System.in).next().equalsIgnoreCase("world")?"Ah, yes. World.":"No. That isn't what I meant.");}

Which don't need any further explanation I think.

Test code:

Try it here.

class M{
  v\u006Fi\u0064 c(){System.\u006Fut.p\u0072int\u006Cn("He\u006C\u006C\u006F... eh, \u0077h\u006Fm sh\u006Fu\u006C\u0064 I g\u0072eet?");System.\u006Fut.p\u0072int\u006Cn(ne\u0077 java.uti\u006C.Scanne\u0072(System.in).next().equa\u006CsIgn\u006F\u0072eCase("\u0077\u006F\u0072\u006C\u0064")?"Ah, yes. \u0057\u006F\u0072\u006C\u0064.":"N\u006F. That isn't \u0077hat I meant.");}

  public static void main(String[] a){
    new M().c();
  }
}

Java 8, 376 361 bytes

v->{System.\u006Fut.p\u0072int\u006Cn("He\u006C\u006C\u006F... eh, \u0077h\u006Fm sh\u006Fu\u006C\u0064 I g\u0072eet?");System.\u006Fut.p\u0072int\u006Cn(ne\u0077 java.uti\u006C.Scanne\u0072(System.in).next().equa\u006CsIgn\u006F\u0072eCase("\u0077\u006F\u0072\u006C\u0064")?"Ah, yes. \u0057\u006F\u0072\u006C\u0064.":"N\u006F. That isn't \u0077hat I meant.");}

-15 bytes switching from Java 7 to 8.

Try it online.

Explanation:

In Java you can use unicode escapes in the form of \u####. Fortunately, u wasn't one of the disallowed characters, so I've used these unicode escapes for the characters that are disallowed.

v->{                            // Method with empty unused parameter & no return
  System.out.println("Hello... eh, whom should I greet?");
                                //  Print the greetings line
  System.out.println(new java.util.Scanner(System.in).next()
                                //  Get the user input from STDIN
    .equalsIgnoreCase("world")? //  If it's equal to (case-insensitive) "world":
      "Ah, yes. World."         //   Print the World-response line
    :                           //  Else:
      "No. That isn't what I meant.");}
                                //   Print the No-response line

Taking the input as parameter and returning a String instead of using STDIN/STDOUT (which I think is allowed reading the challenge again, so not sure why I hadn't done that four years ago when I posted my answer), it would be 239 bytes instead:

s->"He\u006C\u006C\u006F... eh, \u0077h\u006Fm sh\u006Fu\u006C\u0064 I g\u0072eet?\n"+(s.equa\u006CsIgn\u006F\u0072eCase("\u0077\u006F\u0072\u006C\u0064")?"Ah, yes. \u0057\u006F\u0072\u006C\u0064.":"N\u006F. That isn't \u0077hat I meant.")

Try it online.

Commonmark migration
Source Link

#Java 7, 376 bytes

Java 7, 376 bytes

v\u006Fi\u0064 c(){System.\u006Fut.p\u0072int\u006Cn("He\u006C\u006C\u006F... eh, \u0077h\u006Fm sh\u006Fu\u006C\u0064 I g\u0072eet?");System.\u006Fut.p\u0072int\u006Cn(ne\u0077 java.uti\u006C.Scanne\u0072(System.in).next().equa\u006CsIgn\u006F\u0072eCase("\u0077\u006F\u0072\u006C\u0064")?"Ah, yes. \u0057\u006F\u0072\u006C\u0064.":"N\u006F. That isn't \u0077hat I meant.");}

Explanation:

In Java you can use unicode escapes in the form of \u####. Fortunately, u wasn't one of the disallowed characters, so I've used these unicode escapes for the characters that are.

The method above, without unicode escapes:

void c(){System.out.println("Hello... eh, whom should I greet?");System.out.println(new java.util.Scanner(System.in).next().equalsIgnoreCase("world")?"Ah, yes. World.":"No. That isn't what I meant.");}

Which don't need any further explanation I think.

Test code:

Try it here.

class M{
  v\u006Fi\u0064 c(){System.\u006Fut.p\u0072int\u006Cn("He\u006C\u006C\u006F... eh, \u0077h\u006Fm sh\u006Fu\u006C\u0064 I g\u0072eet?");System.\u006Fut.p\u0072int\u006Cn(ne\u0077 java.uti\u006C.Scanne\u0072(System.in).next().equa\u006CsIgn\u006F\u0072eCase("\u0077\u006F\u0072\u006C\u0064")?"Ah, yes. \u0057\u006F\u0072\u006C\u0064.":"N\u006F. That isn't \u0077hat I meant.");}

  public static void main(String[] a){
    new M().c();
  }
}

#Java 7, 376 bytes

v\u006Fi\u0064 c(){System.\u006Fut.p\u0072int\u006Cn("He\u006C\u006C\u006F... eh, \u0077h\u006Fm sh\u006Fu\u006C\u0064 I g\u0072eet?");System.\u006Fut.p\u0072int\u006Cn(ne\u0077 java.uti\u006C.Scanne\u0072(System.in).next().equa\u006CsIgn\u006F\u0072eCase("\u0077\u006F\u0072\u006C\u0064")?"Ah, yes. \u0057\u006F\u0072\u006C\u0064.":"N\u006F. That isn't \u0077hat I meant.");}

Explanation:

In Java you can use unicode escapes in the form of \u####. Fortunately, u wasn't one of the disallowed characters, so I've used these unicode escapes for the characters that are.

The method above, without unicode escapes:

void c(){System.out.println("Hello... eh, whom should I greet?");System.out.println(new java.util.Scanner(System.in).next().equalsIgnoreCase("world")?"Ah, yes. World.":"No. That isn't what I meant.");}

Which don't need any further explanation I think.

Test code:

Try it here.

class M{
  v\u006Fi\u0064 c(){System.\u006Fut.p\u0072int\u006Cn("He\u006C\u006C\u006F... eh, \u0077h\u006Fm sh\u006Fu\u006C\u0064 I g\u0072eet?");System.\u006Fut.p\u0072int\u006Cn(ne\u0077 java.uti\u006C.Scanne\u0072(System.in).next().equa\u006CsIgn\u006F\u0072eCase("\u0077\u006F\u0072\u006C\u0064")?"Ah, yes. \u0057\u006F\u0072\u006C\u0064.":"N\u006F. That isn't \u0077hat I meant.");}

  public static void main(String[] a){
    new M().c();
  }
}

Java 7, 376 bytes

v\u006Fi\u0064 c(){System.\u006Fut.p\u0072int\u006Cn("He\u006C\u006C\u006F... eh, \u0077h\u006Fm sh\u006Fu\u006C\u0064 I g\u0072eet?");System.\u006Fut.p\u0072int\u006Cn(ne\u0077 java.uti\u006C.Scanne\u0072(System.in).next().equa\u006CsIgn\u006F\u0072eCase("\u0077\u006F\u0072\u006C\u0064")?"Ah, yes. \u0057\u006F\u0072\u006C\u0064.":"N\u006F. That isn't \u0077hat I meant.");}

Explanation:

In Java you can use unicode escapes in the form of \u####. Fortunately, u wasn't one of the disallowed characters, so I've used these unicode escapes for the characters that are.

The method above, without unicode escapes:

void c(){System.out.println("Hello... eh, whom should I greet?");System.out.println(new java.util.Scanner(System.in).next().equalsIgnoreCase("world")?"Ah, yes. World.":"No. That isn't what I meant.");}

Which don't need any further explanation I think.

Test code:

Try it here.

class M{
  v\u006Fi\u0064 c(){System.\u006Fut.p\u0072int\u006Cn("He\u006C\u006C\u006F... eh, \u0077h\u006Fm sh\u006Fu\u006C\u0064 I g\u0072eet?");System.\u006Fut.p\u0072int\u006Cn(ne\u0077 java.uti\u006C.Scanne\u0072(System.in).next().equa\u006CsIgn\u006F\u0072eCase("\u0077\u006F\u0072\u006C\u0064")?"Ah, yes. \u0057\u006F\u0072\u006C\u0064.":"N\u006F. That isn't \u0077hat I meant.");}

  public static void main(String[] a){
    new M().c();
  }
}
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#Java 7, 376 bytes

v\u006Fi\u0064 c(){System.\u006Fut.p\u0072int\u006Cn("He\u006C\u006C\u006F... eh, \u0077h\u006Fm sh\u006Fu\u006C\u0064 I g\u0072eet?");System.\u006Fut.p\u0072int\u006Cn(ne\u0077 java.uti\u006C.Scanne\u0072(System.in).next().equa\u006CsIgn\u006F\u0072eCase("\u0077\u006F\u0072\u006C\u0064")?"Ah, yes. \u0057\u006F\u0072\u006C\u0064.":"N\u006F. That isn't \u0077hat I meant.");}

Explanation:

In Java you can use unicode escapes in the form of \u####. Fortunately, u wasn't one of the disallowed characters, so I've used these unicode escapes for the characters that are.

The method above, without unicode escapes:

void c(){System.out.println("Hello... eh, whom should I greet?");System.out.println(new java.util.Scanner(System.in).next().equalsIgnoreCase("world")?"Ah, yes. World.":"No. That isn't what I meant.");}

Which don't need any further explanation I think.

Test code:

Try it here.

class M{
  v\u006Fi\u0064 c(){System.\u006Fut.p\u0072int\u006Cn("He\u006C\u006C\u006F... eh, \u0077h\u006Fm sh\u006Fu\u006C\u0064 I g\u0072eet?");System.\u006Fut.p\u0072int\u006Cn(ne\u0077 java.uti\u006C.Scanne\u0072(System.in).next().equa\u006CsIgn\u006F\u0072eCase("\u0077\u006F\u0072\u006C\u0064")?"Ah, yes. \u0057\u006F\u0072\u006C\u0064.":"N\u006F. That isn't \u0077hat I meant.");}

  public static void main(String[] a){
    new M().c();
  }
}