OCA: Oracle Certified Associate Java SE 8 Programmer I Study Guide: Exam 1Z0-808 (Sybex Study Guide)
Rate it:
Open Preview
46%
Flag icon
you want to remove the 2, you can write numbers.remove(new Integer(2)) to force wrapper class use.
46%
Flag icon
The advantage of specifying a size of 0 for the parameter is that Java will create a new array of the proper size for the return value.
46%
Flag icon
If you like, you can suggest a larger array to be used instead. If the ArrayList fits in that array, it will be returned. Otherwise, a new one will be created.
46%
Flag icon
Converting from an array to a List is more interesting. The original array and created array backed List are linked. When a change is made to one, it is available in the other. It is a fixed-size list and is al...
This highlight has been truncated due to consecutive passage length restrictions.
46%
Flag icon
asList() takes varargs, which let you pass in an array or just type out the String values.
47%
Flag icon
The date and time classes have private constructors to force you to use the static methods.
47%
Flag icon
LocalDate d = new LocalDate(); // DOES NOT COMPILE
48%
Flag icon
There are five ways to create a Period class: Period annually = Period.ofYears(1);               // every 1 year Period quarterly = Period.ofMonths(3);               // every 3 months Period everyThreeWeeks = Period.ofWeeks(3);          // every 3 weeks Period everyOtherDay = Period.ofDays(2);          // every 2 days Period everyYearAndAWeek = Period.of(1, 0, 7);          // every year and 7 days
48%
Flag icon
You cannot chain methods when creating a Period.
49%
Flag icon
There is also Duration, which is intended for smaller units of time.
49%
Flag icon
For Duration, you can specify the number of days, hours, minutes, seconds, or nanoseconds.
49%
Flag icon
DateTimeFormatter f = DateTimeFormatter.ofPattern("MMMM dd, yyyy, hh:mm"); System.out.println(dateTime.format(f));
54%
Flag icon
Java allows the optional specifiers to appear before the access modifier.
54%
Flag icon
an identifier may only contain letters, numbers, $, or _. Also, the first character is not allowed to be a number, and reserved words are not allowed.
68%
Flag icon
Inheritance is the process by which the new child subclass automatically includes any public or protected primitives, objects, or methods defined in the parent class.
Prashant Kumar Rai
Inheritance
69%
Flag icon
Java doesn't support multiple inheritance in the language because studies have shown that multiple inheritance can lead to complex, often difficult-to-maintain code.
69%
Flag icon
Java file can have many classes but at most one public class.
Prashant Kumar Rai
java file
75%
Flag icon
an abstract method may not be marked as final for the same reason that an abstract class may not be marked
75%
Flag icon
a method may not be marked as both abstract and private.
75%
Flag icon
abstract classes can extend other abstract classes and are not required to provide implementations for any of the abstract methods.
76%
Flag icon
the abstract class inherits the abstract methods of the interface but is not required to implement them.
77%
Flag icon
Unfortunately, if the method name and input parameters are the same but the return types are different between the two methods, the class or interface attempting to inherit both interfaces will not compile.
77%
Flag icon
It is not possible in Java to define two methods in a class with the same name and
77%
Flag icon
The compiler would also throw an exception if you define an interface or abstract class that inherits from two conflicting interfaces,
79%
Flag icon
a Java object may be accessed using a reference with the same type as the object, a reference that is a superclass of the object, or a reference that defines an interface the object implements, either directly or through a superclass.
79%
Flag icon
a cast is not required if the object is being reassigned to a super type or interface of the object.
79%
Flag icon
Here are some basic rules to keep in mind when casting variables: Casting an object from a subclass to a superclass doesn't require an explicit cast. Casting an object from a superclass to a subclass requires an explicit cast. The compiler will not allow casts to unrelated types.
80%
Flag icon
A virtual method is a method in which the specific implementation is not determined until runtime. In fact, all non-final, non-static, and non-private Java methods are considered virtual methods, since any of them can be overridden at runtime.
80%
Flag icon
Polymorphic Parameters One of the most useful applications of polymorphism is the ability to pass instances of a subclass or interface to a method.
91%
Flag icon
Underscores are allowed as long as they are directly between two other digits.
91%
Flag icon
Calling System.gc() has no effect on eligibility for garbage collection.
91%
Flag icon
Java does have references to objects, but these are pointing to an object that can move around in memory.
91%
Flag icon
While it does support some parts of functional programming, these occur within a class.
1 3 Next »