CPSC 2150 Exam 1 || A+ Guaranteed.
Some important differences between Java and C++ include... correct answers -Every class in Java can have it's own main method -Everything in Java is inside a class -Since Java runs in its own virtual environment, the same Java code can run on any operating system In Java, a main method must.... correct answers -Be static -Have one argument, an array of Strings -Be inside of a class Anything that is not one of the 8 primitive data types in Java is a... correct answers Reference Data Type In Java, when comparing two variables that are not primitive data types to see if they are equal we should always use... correct answers .equals() A(n) ________________________________ object is an object who's abstract value never changes. The abstract value in the memory location will remain unchanged, however, the pointer could be changed to point to a new memory location. This protects us from aliasing errors. correct answers Immutable Unlike in C++, in Java we don't have a way to explicitly free up memory from a variable that we will no longer use. T/F correct answers True In Java, a class cannot have multiple constructors. T/F correct answers False In Java, you can overload a method by having two methods with the same name and return type, but different arguments. T/F correct answers True It is a best practice to make data fields inside a class public to avoid having to write methods to access and return those data fields T/F correct answers False Arrays in Java always have a length attribute that can be called to get the size of the array. T/F correct answers True A class can be in multiple packages T/F correct answers False Every single class in Java extends the ___________________________ class correct answers Object Packages in Java allow us to have... correct answers -Another layer of encapsulation by encapsulating classes together -A logical structure and grouping of classes Which of the following are helpful methods provided by the Object class correct answers -equals -toString
Written for
- Institution
- CPSC 2150
- Course
- CPSC 2150
Document information
- Uploaded on
- March 25, 2024
- Number of pages
- 5
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
some important differences between java and c in
Also available in package deal