One Pager Cheat Sheet
- Java is a highly efficient,
object-orientedprogramming language developed by James Gosling at Sun Microsystems that is designed for reliability, reusability, and security. - Java offers 8 primitive data types:
byte,short,int,long,float,double,boolean, andcharthat are used to store values of various sizes and types. - Referential types like
Strings,Classes, andObjects, which are created by the programmer, have a default value ofnulland refer to objects. - Variables in Java are
referencesto memory which are declared in different scopes (Local,Instance,Static) and cannot be accessed beyond their scope. - Instance variables are declared inside classes and have different values for each instantiated object, while static variables are
sharedamong all instances of a class. - In Java, user input can be taken in three ways:
Using Scanner,Consoleclass, andBufferedReaderclass. - A
Javaprogram consists of Classes, Objects, Variables and Methods. - In order to compile a Java program, you must save it as a
.javafile and then call the compiler with thejavaccommand before running it with thejavacommand. - Iterative statements, such as
forandwhileloops, allow us to repeat statements until a certain condition is met, such as in the classic Fizz Buzz problem. Decisive Statementsin Java, such asifandelse ifstatements, allow you to control the flow of execution depending on conditions known only during runtime.- Arrays in Java are the most primitive way of aggregating
elements of the same datatypesand can be declared and initialized either withcurly bracesor thenew keyword. Strings in Javaare immutable objects represented by thejava.lang.Stringclass, which implements theSerializable,Comparable, andCharSequenceinterfaces, and Java offers two mutable utility classes:StringBuilderandStringBuffer, with the latter being thread-safe.- Java is an Object-Oriented programming (OOP) language with
classes,objects,constructors, and methods used toimplementthe four basic principles of OOP, namelypolymorphism,abstraction,inheritance, andencapsulation.


