Home > Java > javaTutorial > Cheat Sheet Java

Cheat Sheet Java

王林
Release: 2024-08-30 15:15:55
Original
958 people have browsed it

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

Important Characteristics of Java Language

  1. It is an object-oriented programming language.
  2. It is platform-independent, and thus unlike other programming languages, a compilation of Java is not dependent on any platform-specific system.
  3. From the learning perspective, it is easier to and implements.
  4. It is architecture-neutral and thus portable.
  5. It has three layers of authentication patches from a security perspective.
  6. From the performance perspective, it always ensures proper timecode compilation and high-performance outputs.
  7. It is more dynamic than its competitors and thus provides added advantages for the developers.
  8. It is multi-threaded.
  9. Provides support for the distributed internet environment.

Commands and Content on Cheat Sheet Java

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.

OPERATORS DESCRIPTION / MEANING
> greater than
< less than
>= greater than or equal
<= less than or equal
 == equal to
!= not equal
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
Printing Syntax:

Find below the printing syntax used in Java Cheat Sheet.

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

Loops:

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
It is used to identify any function, class, variable, object or module, etc. In the case of Java, the allowed characters for identifiers are all the alphanumeric characters ([A-Z],[a-z],[0-9]), ‘$ ‘(dollar sign), and ‘_’. Java identifiers are also case-sensitive. Methods for java.lang.Math class: Cheat sheet Java methods available for java.lang.Math classes are as follows
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

Free Tips and Tricks for Using Cheat Sheet Java Commands

The Java Cheat Sheet can be run using a command-line window and running the command as different interrelated methods.

  1. From a programmatic perspective, Java provides a richer and more extensive library method than its competitors, and thus it has become a much preferable language for programmers.
  2. In the case of Java, primitive classes are preferred to the wrapper classes, thus removing the wrapper classes’ slowness.
  3. The Java programs can be interpreted by running the codes in the window and executing the programs simultaneously.
  4. The map function will be applied to all items in an input list.
  5. The reduce function is used to apply some computation on a list and returns a value.
  6. In Java, if the string objects are initiated directly without using the constructor, it would be better from the performance perspective.
  7. As a dynamic programming language, memory allocation in Java using the ‘new’ keyword is necessary. The ‘new’ keyword will show a null pointer exception in the code.
  8. The conditional expressions can be used to write conditional statements to execute the required computations.

Conclusion

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!

Related labels:
source:php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template