Sample Sun Certification Question

Kushal Paudyal April 27th, 2010.This post has 493 views

public static void main (String args[]) {
int[]a1[]=new int[3][3]; //3
int a2[4]={3,4,5,6}; //4
int a2[5]; //5

}}

What is the result of attempting to compile and run the program ?.

  1. Compile time error at lines 3,4,5

  2. Compile time error at line 4,5
  3. Compile time error at line 3

  4. Run time Exception

  5. None of the above

Ans: 2

Explanation:

No value should be specified in the right side of brackets when constructing an array

Related Java Blog Posts




    Your Ad Here


    Sanjaal.com is owned and maintained by Sanjaal Corps, Nepal. The company offers Webhosting and Domain Registration Services, IT Solutions and Business Analysis. Sanjaal.com website features H1B Visa Information, Entertainment Portal, Link Directory Service, Free Articles, Free Open Source Tutorials on Java and J2EE Platform, Digital Photography, High Resolution Picture Gallery and Free Reliable Image Hosting Services. Future plan includes Open Source Software Development Portal, Technical Solutions and Customizable Movie and Music Arena. We would be introducing data backup, data recovery, data hosting and voip solutions. Stay free from phishing – our website does not ask for your credit card and banking information. Happy Surfing!

    Blog Widget by LinkWithin

    Originally posted 2009-07-31 10:22:35.

    • Share/Bookmark


    Trackback URI | Comments RSS

    Leave a Reply

    You must be logged in to post a comment.