Home >Java >javaTutorial >Cheat Sheet Java
Java is a high-level, object-oriented computer programming language, and Sun Microsystems developed it in 1995. The Java-based applications are mainly executed to bytecode which can be executed on any Java Virtual Machine irrespective of any computer architecture. James Gosling started the Java language project in 1991, and initially, it was termed ‘Oak’ after an Oak tree that stood outside Gosling’s office.
Start Your Free Software Development Course
Web development, programming languages, Software testing & others
Java has an extensive library, is interactive, extendable, and contains many in-built methods to compute common operations. Below is the Cheat sheet Java commands mentioned, which perform different kinds of operations:
COMMAND | DESCRIPTION |
+ | To display the next memory section (hexdump-like format) |
– | To display the previous memory section (hexdump-like format) |
coreinfo | To display the platform, version information, and command-line arguments |
basicinfo | To display the main basic information |
info class | To display the inheritance chain and data information for a specific class |
info memory | To display and analyze the memory management (tree format) |
info lock | To display the list of locked objects and available monitors |
extra memory | To save a mentioned memory range conversion to a binary file |
heapdump | To generate a heap dump to a file |
info sym | To display a list of available modules |
javaclass | To display a list of Java classes |
javaobject | To display the specific address, the Java object |
javamonitor | To display the specific address java-monitor |
javathread | To display specific Java thread information |
show heapdump | To display the settings of current heap dump values |
show logging | To display the values of current logging settings |
snaptrace | To extract trace buffers to a specified file |
Operators: The different types of operators in Java are Comparison (Relational) Operators, Assignment Operators, Logical Operators, Bitwise Operators, Membership Operators, and Identity Operators. The different types of numerical operators are int (signed and unsigned), long, float, and complex numbers.
Comparison Operators: Find below the cheat sheet for Java basic comparison operators.
|
DESCRIPTION / MEANING | ||||||||||||||
> | greater than | ||||||||||||||
< | less than | ||||||||||||||
>= | greater than or equal | ||||||||||||||
<= | less than or equal | ||||||||||||||
== | equal to | ||||||||||||||
!= | not equal |
SYNTAX | OUTPUT |
void System.out.print(String S) | To print S |
void System.out.println(String S) | To print S followed by a new line |
void System.out.println() | To print a new line |
Find below the printing syntax used in Java Cheat Sheet.
OUTPUT
SYNTAX
void System.out.print(String S)
To print S
void System.out.println(String S)
To print S followed by a new line
void System.out.println()
To print a new line
The looping operators in Java are while, for, and nested. The nested loops are while, for, do…while, etc. The different loop control statements are break, continue and pass statements.
Identifiers:METHOD | DESCRIPTION |
static double abs(double a) | Returns the absolute value of a double value |
static int abs(int a) | Returns the absolute value of an int value |
static float abs(float a) | Returns the absolute value of a float value |
static int max(int a, int b) | Returns the greater of two int value |
static float max(float a, float b) | Returns the greater of two float value |
static long max(long a long b) | Returns the greater of two long value |
static int min(int a, int b) | Returns the smaller of two int value |
static float min(float a float b) | Returns the smaller of two float value |
static long min(long a long b) | Returns the smaller of two long value |
static double random() | Returns a positive double value that is greater than or equal to 0.0 but less than 1.0 |
static double ulp(double d) | Returns the size of an argument ulp |
static double ulp(float f) | Returns the size of an argument ulp |
static double sin(double a) | Returns the hyperbolic sine of a double value |
static double tan(double a) | Returns the trigonometric tangent of an angle |
METHOD | DESCRIPTION |
static double abs(double a) | Returns the absolute value of a double value |
static int abs(int a) | Returns the absolute value of an int value |
static float abs(float a) | Returns the absolute value of a float value |
static int max(int a, int b) | Returns the greater of two int value |
static float max(float a, float b) | Returns the greater of two float value |
static long max(long a long b) | Returns the greater of two long value |
static int min(int a, int b) | Returns the smaller of two int value |
static float min(float a float b) | Returns the smaller of two float value |
static long min(long a long b) | Returns the smaller of two long value |
static double random() | Returns a positive double value that is greater than or equal to 0.0 but less than 1.0 |
static double ulp(double d) | Returns the size of an argument ulp |
static double ulp(float f) | Returns the size of an argument ulp |
static double sin(double a) | Returns the hyperbolic sine of a double value |
static double tan(double a) | Returns the trigonometric tangent of an angle |
The Java Cheat Sheet can be run using a command-line window and running the command as different interrelated methods.
Java is easy to use, and its syntax is easier to remember and code the programs easily. Java can be used in web development technologies using different frameworks and technologies supporting Java. Based on the type of project need, time of work, and other discussed aspects; java should be used to reach the desired goal.
The above is the detailed content of Cheat Sheet Java. For more information, please follow other related articles on the PHP Chinese website!