Sunday 20 February 2011

String literal questions on java and answer with solution




Objective type
questions of string literals and answers in java programming



(1)



public class Literal {

    public static void main(String[] args) {

         String a="c:\\tc\\bin";

         System.out.println(a);

    }

}



What will output when you compile and run the above code?



(a) c:\\tc\\bin

(b) c:\tc\bin

(c) c:   c\bin

(d) Compiler error











Answer:  (b)



(2)

No comments:

Post a Comment