Roshan Sharma
Roshan Sharma Blogs πŸš€


Roshan Sharma Blogs πŸš€

Ultimate Cheatsheet for getting started with Java 🍡

Ultimate Cheatsheet for getting started with Java 🍡

Roshan Sharma's photo
Roshan Sharma
Β·Mar 7, 2023Β·

4 min read

Java is one of the most powerful programming languages that has been used to build some of the most complex and widely used applications in the world. Whether you are a beginner or an experienced programmer.

This cheat sheet will provide you with a comprehensive guide to the most important Java concepts, commands, and some of the links which you can explore on your own to have a deep dive into the concepts. πŸš€

Variables and Data Types

Variables are used to store data in Java. Java has different types of data types like int, float, double, boolean, char, etc. Each data type has a different range and precision. It’s important to understand the differences between data types and when to use each one.

Control Statements

Control statements are used to control the flow of a program. Java has three types of control statements: selection (if-else), iteration (while, do-while, for), and jump (break, continue, return).


Arrays are used to store multiple values of the same type in Java. Java supports one-dimensional and multi-dimensional arrays.


Methods are a block of code that performs a specific task. Java methods can take parameters and return values. They can also be overloaded, which means having multiple methods with the same name but different parameters.

Classes and Objects

Classes are used to define objects in Java. An object is an instance of a class that has a state (attributes) and behavior (methods). Java supports inheritance, which means creating a new class based on an existing class.


Inheritance is a mechanism in Java that allows one class to inherit the properties of another class. The class that is inherited is called the superclass or parent class, and the class that inherits is called the subclass or child class. Inheritance is useful for code reuse and creating hierarchies of classes.


Polymorphism is a feature of Java that allows objects of different classes to be treated as if they were of the same type. Java supports two types of polymorphism: compile-time polymorphism (method overloading) and runtime polymorphism (method overriding).

Exception Handling

Exception handling is used to handle errors that occur during program execution. Java provides a set of built-in exception classes and a try-catch-finally block for handling exceptions.


Input/output (I/O) in Java is used to read and write data to and from files, the console, and other devices. Java provides several classes for I/O, including BufferedReader, Scanner, FileInputStream, and FileOutputStream.


Generics are used to write code that can work with different data types. Java generics allow you to create classes, interfaces, and methods that can work with any data type.

Collections Framework

The Collections Framework in Java is a set of classes and interfaces for working with collections of objects. Java provides several collection classes, including ArrayList, LinkedList, HashSet, and TreeMap.


Threads are used to run multiple tasks simultaneously in Java. Java provides built-in support for multithreading using the Thread class and Runnable interface.

Java Database Connectivity (JDBC)

Java Database Connectivity (JDBC) is a Java API for connecting to relational databases. JDBC provides a set of classes and interfaces for executing SQL statements, retrieving data, and handling exceptions.

Java Servlets and JavaServer Pages (JSP)

Java Servlets and JavaServer Pages (JSP) are technologies used for building web applications in Java. Servlets are Java classes that handle HTTP requests and responses, while JSP is a technology for creating dynamic web pages using Java code.


  1. javac: This command is used to compile Java source code files into bytecode files.

  2. java: This command is used to execute Java bytecode files on the Java Virtual Machine (JVM).

  3. jar: This command is used to package Java class files into a JAR (Java ARchive) file.

  4. javadoc: This command is used to generate API documentation from Java source code comments.

  5. jdb: This command is used to debug Java programs using the Java Debugging Interface (JDI).

  6. jdeps: This command is used to analyze class files and JAR files for dependencies on other classes and JAR files.

  7. jinfo: This command is used to display system properties and command-line options for a running Java process.

  8. jmap: This command is used to generate a memory map of a running Java process.

  9. jps: This command is used to list the Java processes running on a machine.

  10. jstack: This command is used to generate a stack trace of a running Java process.

  11. jstat: This command is used to monitor the performance statistics of a running Java process.

  12. keytool: This command is used to manage digital certificates and keys.



If you found this blog post helpful, a clap would be really applicable, and follow for more technical content on Programming and Development. πŸ₯‘

Did you find this article valuable?

Support Roshan Sharma by becoming a sponsor. Any amount is appreciated!

Learn more about Hashnode Sponsors
Share this