Question 3 1 pts Edit this Question Delete this Question 0 m

Question 3 1 pts

Edit this Question Delete this Question

0 multiple_choice_question 39859430

<p>Given a Point class, how would you declare a variable which is an array of 10 Point?</p>

Given a Point class, how would you declare a variable which is an array of 10 Point?

Point[] points = new Point()[10];

Solution


Given a Point class, how would you declare a variable which is an array of 10 Point?

    Point[] points = new Point()[10];
    Point[] points = new Point[10];
    Point points = new Point[10];
    points = new Point[10];

    Ans: Point[] points = new Point[10];

    Step 1
    Point[] points; => declaring array of Point class reference of size 10

    Step 2
    Array is also Object, so need to create object
    points = new Point[10]; => all 10 elements( 10 Point object) initilizes with \'null\'

    Combining Step 1 and 2
    Point[] points = new Point[10];

Question 3 1 pts Edit this Question Delete this Question 0 multiple_choice_question 39859430 <p>Given a Point class, how would you declare a variable whic

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site