Computer Science > QUESTIONS & ANSWERS > CS 1102 Graded Quiz with Answers. 100% proven pass rate. Rated A+ (All)
To declare a constant MAX_LENGTH as a member of the class, you write - ✔✔final static double MAX_LENGTH = 99.98; What is the output of the following code? import java.util.Date; public cl... ass Test { public static void main(String[] args) { Date date1 = new Date(); Date date2 = new Date(); System.out.print((date1 == date2) + " " + (date1.getClass() == date2.getClass())); } } - ✔✔false true The abbreviation OOP stands for: - ✔✔Object oriented programming In the following code, what is the newStudent method called: public class newStudent { public String name; public int age; public newStudent() { age=5; name = "Jim Jones"; } } - ✔✔constructor Consider the following code, which output is correct? public class Student { int age; static int age2 = 3; public static void main(String[] args) { Student student1; Student student2; Student student3; student1 = new Student(); student1.age = 10; student2 = student1; student2.age -= 5; student3 = new Student(); System.out.println(student1.age+" "+student2.age); } } - ✔✔5 5 In the following code what is the getName() method referred to: public class Student { public String name; public int age; public String getName() { return name; } public void setName( String newName ) { name = newName; } } - ✔✔getter method A method that is associated with an individual object is called: - ✔✔an instance method In the following code what is the setName() method referred to: public class Student { public String name; public int age; public String getName() { return name; } public void setName( String newName ) { name = newName; } } - ✔✔setter method What is the output of the following code? public class Test { public static void main(String[] args) { String s1 = new String("Welcome to Java!"); String s2 = new String("Welcome to Java!"); if (s1 == s2) System.out.println("s1 and s2 reference to the same String object"); else System.out.println("s1 and s2 reference to different String objects"); } } - ✔✔s1 and s2 reference to different String objects Which of the following code in A or B, or both creates an object of the java.util.Date class? A: public class Test { public Test() { new java.util.Date(); } } B: public class Test { public Test() { java.util.Date date = new java.util.Date(); } } - ✔✔Both True or False: The variables that an object contains are called local variables. - ✔✔False True or False: The area of memory that objects reside in is known as the stack. - ✔✔False True or False: In the following code, the object created from class Student is stored in the variable myStudent. Student myStudent; myStudent = new Student(); - ✔✔False True or False: When a programmer neglects to delete objects that are no longer used it is referred to as a memory leak. - ✔✔True [Show More]
Last updated: 2 years ago
Preview 1 out of 19 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
4 different versions, rated A+ masterpieces
By bundleHub Solution guider 2 years ago
$18
4
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Aug 16, 2022
Number of pages
19
Written in
This document has been written for:
Uploaded
Aug 16, 2022
Downloads
0
Views
152
In Scholarfriends, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·