350 Câu hỏi trắc nghiệm môn Lập trình mạng có đáp án - Phần 1

Cho đoạn mã sau. Giá trị in ra của câu lệnh dòng thứ 6 là: class Q7 { public static void main(String[] args) { double d = 12.3; Decrement dec = new Decrement(); dec.decrement(d); System.out.p

38/50

Cho đoạn mã sau. Giá trị in ra của câu lệnh dòng thứ 6 là:
class Q7 {
public static void main(String[] args) {
double d = 12.3;
Decrement dec = new Decrement();
dec.decrement(d);
System.out.println(d);
}
};
class Decrement {
public void decrement(double decMe) {
decMe = decMe - 1.0;
}
}

0.0

-1.0

12.3

11.3

Giải thích

C là đáp án đúng