Java Cheat Sheet Pdf Free Download
OOP
EncapsulationDownload Java Cheat Sheet app for Android. There is Java in your pocket! Learn Java gives you the basics of Java.
IMAP migration. /recover-my-file-with-serial-key.html.
The process of binding related classes, objects and operations together is called EncapsulationUsing access modifiers, packagesAbstractionThe process of specifying what to do without specifying how to do itUsing abstract classes and interfacesInheritanceWhen one class inherits the properties of another classUsing Aggregation, CompositionPolymorphismSame thing is done in different waysUsing compile-time and run-time polymorphismEncapsulation
defaultaccessible to classes only in the same packagepublicaccessible to all classes in any packageprivateaccessible to only a specific method, or classprotectedaccessible to classes in the same package, and sub-classes of this classAbstraction
Abstract ClassWhen a class has one or more unimplemented methods, it should be declared abstract. The sub-classes should provide implementation for the unimplemented methods, else they should also be declared abstractUsed: When default implementation is needed for some methods, and specific implementations for other methods based on the class implementing themInterfaceBlueprint of a class. It contains only static, final variables and only unimplemented methods. Classes implement the interface should implement all methods of the interface, or be declared abstractUsed: to support multiple inheritanceAbstract classes don't support multiple inheritance, whereas interfaces doInheritance
AggregationWhen one class contains a reference of another classLoosely coupled classesAssociationWhen one class is made up of another classTightly coupled classesJava does't support multiple inheritance directly, it supports it only via InterfacesPolymorphism
Compile-timeAlso called overloading. When methods have same name but different signature (return-type, number of parameters, type of parameters etc)Run-timeAlso called overriding. When child-classes over-write method implementations of parent-class.static keyword
static fieldShared by all members of the class. It can be accessed before objects are createdJava Cheat Sheet Pdf Free Download 32-bit
static methodCan be accessed without creating an instance of the class. They can only access static variables and static methods. Cannot access this or superstatic blockUsed when some computation is to be done to initialize the static variables. This block is executed once when the class is initially loaded into memorystatic classWe cannot declare top-level classes as static. Only inner classes can be static. A static class cannot access non-static members of the Outer class. It can access only static members of Outer classfinal
fieldstreated as constantsmethodscannot be overridden by child classesclassescannot be inheritedfinalize( )
finalize() method is a protected and non-static method of java.lang.Object class. This method will be available in all objects you create in java. This method is used to perform some final operations or clean up operations on an object before it is removed from the memoryString Creation
Literal : String s = ' 'Creates Strings in String pool, in JVM. Multiple strings can have same value. Only one copy of the word exists in the String pool, and the references of it are updated.Object: String s = new String( );Creates a string object in heap. The heap in-turn checks the JVM String Pool to see if there exists a string with same value.String s1 = 'abc';String s2 = 'abc';
s1 s2 returns true;
String s1 = new String('abc');
String s2 = new String('abc');
s1 s2 returns false;
But s1.equals(s2) returns true;