The answer is the letter D and I tested it (Code below:). An object can be a variable, as it is not primitive, if we call it without assigning values it will have the value null as default, the double has the default value of 0.0 if we don't assign a value, so when passing the println command with the parameters it returns null:0.0
class Cart {
Product p;
double totalAmount;
}
class Product {
String name;
Double price;
}
public class Test {
public static void main (String[] args) {
Cart c = new Cart();
System.out.println(c.p + ":" + c.totalAmount);
}
}
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
iSnover
Highly Voted 2 years, 3 months ago5df1d00
Most Recent 3 months, 2 weeks ago