+ Reply to Thread
Results 1 to 4 of 4

Thread: Code Puzzles

  1. #1

    Code Puzzles

    proove your coding skills with code puzzles :)
    - don't use a compiler
    - think twice



    i'll start with a neat java puzzle:
    - does this compile? why? why not?
    - what will happen if you remove the fifth line? why?
    Code:
    1. public class Test {
    2.	 public static void Main(String[] args) {
    3.		 System.out.print("The SB-Innovation URL: ");
    4.		 http://www.sb-innovation.de/
    5.		 System.out.println(".");
    6.	 }
    7. }
    Last edited by ghostfucker; 23.08.12 at 19:17.
    Reply With QuoteReply With Quote
    Thanks

  2. #2
    Advanced User ParamouR's Avatar
    Join Date
    01.09.10
    Location
    Third Rome
    P2P Client
    µ
    Posts
    773
    Activity Longevity
    0/20 16/20
    Today Posts
    0/5 ssssss773
    This should compile/run if you edit the "main"




    Maybe you would have to comment 4th line, don't know
    Show respect to all people, but grovel to none​


    Reply With QuoteReply With Quote
    Thanks

  3. #3
    Quote Originally Posted by ghostfucker View Post

    - does this compile? why? why not?
    - what will happen if you remove the fifth line? why?
    Code:
    1. public class Test {
    2.	 public static void Main(String[] args) {
    3.		 System.out.print("The SB-Innovation URL: ");
    4.		 http://www.sb-innovation.de/
    5.		 System.out.println(".");
    6.	 }
    7. }
    1. It won't compile because of the 4th line. you have to comment it.
    2. the compiler won't print a new line with "." in it, so after commenting the 4th line the result will be:
    Code:
    The SB-Innovation URL: .
    After removing the 5th line the result will be :
    Code:
    The SB-Innovation URL:
    Last edited by Lucius; 03.10.14 at 19:20.
    Reply With QuoteReply With Quote
    Thanks

  4. #4

    Join Date
    12.02.22
    Location
    Canada
    P2P Client
    utorrent
    Posts
    10
    Activity Longevity
    0/20 3/20
    Today Posts
    0/5 sssssss10
    nope syntax error on 4th line
    Reply With QuoteReply With Quote
    Thanks

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •