- Oracle Documentations
- About
- Enum
- InstanceOf
- Nested Class
- Methods from Object Class
- Imports
- Casting Values
- Java Inheritance
- Polymorphism
- Referenceable Objects and References
- Design Principles
- Design Pattern
- Functional Interface
- Lambda Expression
- Method Reference
- Generics
- Collections
- Array
- Arrays
- Stream API
- Help
- License
- Exam Java SE 8 Programmer II
- Java® Language Specification. Java SE 8 Edition
- Java Platform, Standard Edition (Java SE) 8
- Java™ Platform, Standard Edition 8 API Specification
- This project created for educational purposes, and this project may contain invalid or false "Information or Cod Examples".
- Always check the "Information or Cod Examples" you are learning.
- Implementation abstract method in each "Enum Value".
- Each and every "Enum Value", required to implement this abstract method.
- If "Enum Value", have implemented method, "Enum" required to have defined this abstract method, so that later this method could be called.
- Is allowed implementation many abstract method in "Enum Values".
- Exist two types of classes: top-level class, Nested Class.
- Nested Class divided into two types: "Static Nested Class" and "Inner Class".
- Sywchestvyet "Anonymous class". "Anonymous class" siempre is "Nested Class" no potom stanovitca libo "Static Nested Class" libo "Inner Class".
- "Nested Class" may have "access modifier": private, default, protected, public.
- Exist four types of Static Nested Class: interface, abstract class, class, enum.
- Non-static variables from "top-level class" cannot be used in the "static nested class".
- Static variables from "top-level class" can be used in the "static nested class".
- Not allowed definition "static nested class" in the method body.
- Not allowed definition "static nested class" in the static method body.
- The "Inner Class" has a subtype that name is "Local Inner Class".
- Ekzempliar "Inner Class" vsehda dolzen sodirzat ssulky na "top-level class".
- Esli sozdaietsa "top-level class" eto ne znachit chto proisxodit sozdanie "Inner Class".
- Esli sozdaietsa "Inner Class" to obiazan sywchestvovat ekzempliar "top-level class". I "Inner Class" bydet ssulatsa na "top-level class".
- Raznue "Inner Class" mohut ssulatsa na odin i totze "top-level class".
- "Inner Class" mozet bit obiavlion v methode. No znachenie kotoroe vozvrawchaet ethot method ne mozet bit tipos etoho "Inner Class". "Inner Class" kotorui obiavlaetsa v nytri methoda, ne viden za figurnumi scobcami etoho methoda. Znachenie cotoroe vozvrawchaet method mozet bit "Object type" i takim sposobom mozno vozvrawcaht "Inner Class" kororui opredelon v methode.
- java memory leak. "Inner Class" mozet sprovocurovat "java memory leak". Do toho vremeni kohda ziv "Inner Class" bydet ziv "top-level calss", "Garbage Collector" ne smozet ydalit "top-level class".
- Exist four types of Inner Class: interface, abstract class, class, enum.
- The definition for the "Local Inner Class".
- Local Inner Class can't have an access modifier.
- Local Inner Class can't be declared static.
- Local Inner Class have access to local variables without access modifier and final local variables of the method.
- If type of an "Anonymous Class" is "Abstract Class". And this "Abstract Class" have "abstract methods", all "abstract methods" from this "Abstract Class" is mandatory must be defined.
- If type of an "Anonymous Class" is "Interface". And this "Interface" have "abstract methods", all "abstract method" from this "Interface" is mandatory must be defined.
- Type of an "Anonymous Class" is "Static Nested Class".
- Type of an "Anonymous Class" is "Inner Class".
- If some type of an "Anonymous Class" have "final method" and you want implement this "final method", that will be impossible. It is not allowed to redefine final methods.
- If some type of an "Anonymous Class" have "static method" and you want implement this "static method", that will be impossible. It is not allowed to redefine static methods.
- Private methods are not allowed to redefine. Methods of access modifier: public, protected, package is allowed redefine, considering the relationship policy of "Access Modifiers".
- Access to variables of an "Anonymous Class".
- Access to variables of an "Anonymous Class" using "this".
- Access to final variables of an "Anonymous Class".
- The final variables from the "Anonymous Class" cannot be changed.
- Access to static variables of an "Anonymous Class".
- The final variables from the "Anonymous Class" can be changed.
- Private variables are not allowed to redefine. Variables of access modifier: public, protected, package is allowed redefine, considering the relationship policy of "Access Modifiers".
- If casting operation is incorrect while be throw "Runtime Exception".
- 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.
- Even when the code compiles without issue, an exception may be thrown at runtime if the object being cast is not actually an instance of that class.
- Casting an object from a subclass to a superclass doesn’t require an explicit cast.
- Virtual Methods in object-oriented programming, a virtual function or virtual method is a function or method whose behaviour can be overridden within an inheriting class by a function with the same signature to provide the polymorphic behavior.
- "Class" can only be "extend" from one "class" or one "abstract class".
- "Class" can be "implement" may "interfaces".
- If the "Class is final", other class cannot be inherited from it.
- "Interface" can be "extend" from many others "interfaces".
- "Interface" cannot be "extend" from "class" or "abstract class".
- "Marker Interface" - this is an "interface" that has no methods.
- Interfaces cannot extend classes, nor can classes extend interfaces.
- Interfaces may also not be marked final or instantiated directly.
- There are additional rules for default methods, such as Java failing to compile if a class or interface inherits two default methods with the same signature and doesn’t provide its own implementation.
- The compiler automatically adds "public static final" to all interface variables, if the developer does not provide them.
- Only "public static final" variables are allowed define in the "Interface". All variables from "Interface" is "public static final".
- "Abstract Class" can only be "extend" from one "class" or one "abstract class".
- "Abstract Class" can be "implement" many "interfaces".
- The dictionary definition of polymorphism refers to a principle in biology in which an organism or species can have
many different forms or stages. This principle can also be applied to object-oriented programming and languages like
the Java language. Subclasses of a class can define their own unique behaviors and yet share some of the same
functionality of the parent class.
- Polymorphism is the ability of a single interface to support multiple underlying forms. In Java, this allows multiple
types of objects to be passed to a single method or class. In Java, this allows multiple types of objects to be
passed to a single method or class.
- Types of Polymorphism:
- Inheritance.
- Generics.
-
-
- Inheritance.
- We can summarize this principle with the following two rules:
- The type of the object determines which properties exist within the object in memory.
- The type of the reference to the object determines which methods and variables are accessible to the Java program.
- The type of the object determines which properties exist within the object in memory.
- An object is an instance of a class created from it using the new keyword.
- Classes, interfaces, arrays, enumerations and, annotations are the in Java are reference types in Java. Reference
variables hold the objects/values of reference types in Java.
- A design principle is an established idea or best practice that facilitates the software design process.
- In general, following good design principles leads to:
- More logical code
- Code that is easier to understand
- Classes that are easier to reuse in other relationships and applications
- Code that is easier to maintain and that adapts more readily to changes in the application requirements
JavaBean naming conventions:
1. Properties are private.
2. A public no-argument constructor.
3. Getter for non‐boolean properties begins with "get".
4. Getters for boolean properties must begin with "is".
5. Getters for Boolean properties must begin with "get".
6. Setter methods begin with "set".
7. The method name must have a prefix of "set", "get", "is" followed by the first letter of the property in uppercase and followed by the rest of the property name.
8. Implements Serializable.Although boolean values use "is" to start their getter method, the same does not apply to instances of the wrapper Boolean class, which use "get".
- A design pattern is an established general solution to a commonly occurring software development problem. The purpose of a design pattern is to leverage the wealth of knowledge of developers who have come before you in order to solve old problems that you may encounter easily. It also gives developers a common vocabulary in which they can discuss common problems and solutions.
- Use a constructor to set all properties of the object.
- Mark all of the instance variables private and final.
- Don’t define any setter methods.
- Don’t allow referenced mutable objects to be modified or accessed directly.
- Prevent methods from being overridden.
- The parentheses can be omitted in a lambda expression if there is exactly one input parameter and the type is not explicitly stated in the expression. This means that expressions that have zero or more than one input parameter will still require parentheses.
- Pass one parameter to "Lambda Expression".
- Pass two or many parameters to "Lambda Expression".
- Oracle Java Documentation. The Java Generic Tutorials.
- Covariant, Contravariance, Invariance.
- Oracle Java Documentation. Lower Bounded Wildcards.
- Oracle Java Documentation. Upper Bounded Wildcards.
- 1.
- For any type of collections, the methods is very important: equals, hashCode, compare, compareTo.
- A LinkedList implements List and Queue.
- If you need a stack, use an ArrayDeque instead
- A HashSet stores its elements in a hash table. This means that it uses the hashCode() method of the objects to retrieve them more efficiently.
- The equals() method is used to determine equality.
- A TreeSet stores its elements in a sorted tree structure. The main benefit is that the set is always in sorted order.
- TreeSet implements the NavigableSet interface. And the interface NavigableSet implemented SortedSet. And the interface SortedSet implemented Set.
- You use a queue when elements are added and removed in a specific order. Queues are typically used for sorting elements prior to processing them.
- A queue is a collection that orders its elements in a specific order for processing. A typical queue processes its elements in a FIFO (first-in, first-out) order, but other orderings are possible.
- Compiler Warning is different from a compiler error in that all of the code still compiles with a compiler error. The compiler warning is Java informing you that you should take a closer look at something.
Apache 2.0, see LICENSE.