List jar content
Exctract jar archive
Run jar archive with entry point
Run jar archive without entry point
|boolean||true or false|
|char||16-bit, Unicode character|
|byte||8-bit, signed, two\u2019s complement integer|
|short||16-bit, signed, two\u2019s complement integer|
|int||32-bit, signed, two\u2019s complement integer|
|long||64-bit, signed, two\u2019s complement integer|
|float||32-bit, IEEE 754, floating-point value|
|double||64-bit, IEEE 754|
If you want to ensure that your application produces exactly the same results on
different platforms, you can use the special keyword strictfp as a class modifier
on the class containing the floating-point manipulation.
numeric types default to the appropriate flavor of zero,
characters are set to the null character (\0),
and Boolean variables have the value false.
Local variables, which are declared inside a method and live only for the duration of a method call,
on the other hand, must be explicitly initialized before they can be used.
takes an integer (or a numeric argument that can be automatically "promoted" to an integer type), a String type argument, or an "enum" type and selects among a number of alternative, constant case branches.
break & contiune labels
The break and continue statements look like those in the C language, but Java's forms have the additional ability to a label as an argument and jump out multiple levels to the scope of the labeled point in the code.
The expression null can be assigned to any reference type. It means "no reference". A null reference can't be used to reference anything and attempting to do so generates a NullPointerException at runtime.
In Java 7, there is an alternative to using multiple catch clauses, and that is to handle multiple discrete exception types in a single catch clause using the | or syntax:
Using this | or syntax, we receive both types of exception in the same catch clause. So, what is the actual type of the e variable that we are passing to our log method? (What can we do with it?) In this case, it will be neither ZipException nor SSLException but IOException, which is the two exceptions' nearest common ancestor (the closest parent class type to which they are both assignable). In many cases, the nearest common type among the two or more argument exception types may simply be Exception, the parent of all exception types.
The optional expression may evaluate to either a primitive or object type. Either way, its sole purpose is to be turned into a string and shown to the user if the assertion fails; most often you'll use a string message explicitly.
- To enable assertions, use flag -ea or -enableassertions
- To turn on assertions for a particular class, append the class name
- To turn on assertions just for particular packages, append the package name with trailing ellipses (…)
- To disable assertions in general, for a particular class or for a particular package, use flag -da or -disableassertions. You can combine all this to achieve arbitrary groupings
Java supports the C-style curly braces construct for creating an array and initialize its elements
We can use curly braces syntax also to create anonymous arrays.
Good OOP design practices
- Hide as much of your implementation as possible. Define accessor methods to set and return values.
- Use composition instead of inheritance. Do you really need to inherit the whole public interface of an object (to be a "kind" of that object) or whether you can just delegate certain jobs to the object and use it by composition.
- Minimize relationships between objects and try to organize related objects in packages. The more loosely coupled your objects are, the easier it will be to reuse them later.
Inside the printObjects method, the variable list is actually an Object  type.
constructor and this method
You can invoke a second constructor (delegate to it) only as the first statement of your constructor. For example, the following code is illegal and causes a compile-time error:
The simple model name constructor can't do any additional setup before calling the more explicit constructor. It can't even refer to an instance member for a constant value:
The instance variable defaultDoors is not initialized until a later point in the chain of constructor calls setting up the object, so the compiler doesn't let us access it yet. Fortunately, we can solve this particular problem by using a static variable instead of an instance variable:
The static members of a class are initialized when the class is first loaded into the virtual machine, so it's safe to access them in a constructor.
It's executed once, at the time the object is constructed, or, in the case of a code block marked static, at the time the class is loaded
It allows the static members of a class to have complex initialization just like objects do with constructors:
The first time the class ColorWheel is referenced and loaded, the static components of ColorWheel are evaluated in the order they appear in the source.