| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
// hello single line comment
/* Hello from multi line comment */
/** * This class {@code Shape} is an abstract class to demonstrate partial abstraction * and features of abstract class. * * @author Vikram Gupta */
int to float and int to byte and other primitives
Throwable - The Throwable class is the superclass of all errors and exceptions in the Java language. Only objects that are instances of this class (or one of its subclasses) are thrown by the Java Virtual Machine or can be thrown by the Java throw statement. Similarly, only this class or one of its subclasses can be the argument type in a catch clause. For the purposes of compile-time checking of exceptions, Throwable and any subclass of Throwable that is not also a subclass of either RuntimeException or Error are regarded as checked exceptions. Instances of two subclasses, Error and Exception, are conventionally used to indicate that exceptional situations have occurred. Typically, these instances are freshly created in the context of the exceptional situation so as to include relevant information (such as stack trace data)
Error - An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions. The ThreadDeath error, though a "normal" condition, is also a subclass of Error because most applications should not try to catch it.
Exception - The class Exception and its subclasses are a form of Throwable that indicates conditions that a reasonable application might want to catch. The class Exception and any subclasses that are not also subclasses of RuntimeException are checked exceptions. Checked exceptions need to be declared in a method or constructor's throws clause if they can be thrown by the execution of the method or constructor and propagate outside the method or constructor boundary.
Generics avoid code duplication and with the help of Generics the same class or method can be reused for different data types.
The purpose of the Optional class is to provide a type-level solution for representing optional values instead of null references.
A container object which may or may not contain a non-null value. If a value is present, isPresent() returns true. If no value is present, the object is considered empty and isPresent() returns false.
To create an empty Optional object, we simply need to use its empty() static method: Optional<String> empty = Optional.empty(); assertFalse(empty.isPresent());
We can also create an Optional object with the static method of(): String name = "baeldung"; Optional<String> opt = Optional.of(name); assertTrue(opt.isPresent()); However, the argument passed to the of() method can't be null. Otherwise, we'll get a NullPointerException:
Method Reference
| Back | FazBrowse Home | New Git URL |