Here are some of my latest thoughts on cheat-sheet…
Articles on this page
Java CheatSheet

Modern Java is a strongly-typed, eagery evaluated, case sensative, yet whitespace insensative language. It uses hierarchies of classes/types to structure data, but also has first-class support for functional-style algebraic datatypes.
Java programs are made up of ‘classes’, classes contain methods, and methods contain commands. To just try out a snippet of code, we can
Open a terminal and enter
jshell; then enter:1 + 2 // The jshell lets you try things out! // Say hello in a fancy way import javax.swing.*; JOptionPane.showMessageDialog(new JFrame(), "Hello, World!");- Alternatively, in IntelliJ, click Tools then Groovy Console to try things out!
- Finally, VSCode allows arbitrary Java code to be sent to a
jshellin the background(!) and it echoes the result in a friendly way.
In order to run a java program, it must have a main method as an entry point.
public class LearnJava {
// In order to run a java program, it must have a main method as an entry
// point.
public static void main(String[] args) {
System.out.println("Hello World!");
// Use System.out.printf() for easy formatted printing.
System.out.printf("pi = %.5f", Math.PI); // => pi = 3.14159
}
}
Arabic CheatSheet

Life & Computing Science by Musa Al-hassy is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License