CTP 150 Final Exam
Which of Java packages is automatically imported into a Java program? - Answer- Consider the following code fragment: Circle c1 = new Circle(3); Circle c2 = new Circle(3); Circle c3 = c2; boolean condition = s(c1); What is the value of condition assuming that two circles are considered equal if they have the same radius value? - Answer- True Data hiding, which means that critical data stored inside the object is protected from code outside the object, is accomplished in Java by - Answer- Using the private access specifier on the class fields Given the following code, what will be the value of finalAmount when it is displayed? public class Order { private int orderNum; private double orderAmount; private double orderDiscount; public Order(int orderNumber, double orderAmt, double orderDisc) { orderNum = orderNumber; orderAmount = orderAmt; orderDiscount = orderDisc; } public double finalOrderTotal() { return orderAmount - orderAmount * orderDiscount; } }
Escuela, estudio y materia
- Institución
- CTP 150
- Grado
- CTP 150
Información del documento
- Subido en
- 6 de octubre de 2023
- Número de páginas
- 14
- Escrito en
- 2023/2024
- Tipo
- Examen
- Contiene
- Preguntas y respuestas
Temas
-
ctp 150 final exam
-
which of java packages is automatically imp
-
consider the following code fragment
Documento también disponible en un lote