Home / Java Programming / Java.lang Class :: Discussion

Discussion :: Java.lang Class

  1. What will be the output of the program?

    public class Test178  {      public static void main(String[] args)      {         String s = "foo";          Object o = (Object)s;          if (s.equals(o))          {              System.out.print("AAA");          }          else          {             System.out.print("BBB");          }          if (o.equals(s))          {             System.out.print("CCC");          }          else          {             System.out.print("DDD");          }      }  } 

  2. A.
    AAACCC
    B.
    AAADDD
    C.
    BBBCCC
    D.
    BBBDDD

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    No answer description available for this question. Let us discuss.


Be The First To Comment