Core Java” is Sun’s term, used to refer to Java SE, the standard edition and a set of related technologies, like the Java VM, CORBA, et cetera. This is mostly to differentiate from, say, Java ME or Java EE
Features of Core Java
Java is easy to learn and its syntax is quite simple, clean and easy to understand.The confusing and ambiguous concepts of C++ are either left out in Java or they have been re-implemented in a cleaner way.
Eg : Pointers and Operator Overloading are not there in java but were an important part of C++.
2) Object Oriented
In java everything is Object which has some data and behaviour. Java can be easily extended as it is based on Object Model.
Java makes an effort to eliminate error prone codes by emphasizing mainly on compile time error checking and runtime checking. But the main areas which Java improved were Memory Management and mishandled Exceptions by introducing automatic Garbage Collector and Exception Handling.
4) Platform Independent
Unlike other programming languages such as C, C++ etc which are compiled into platform specific machines. Java is guaranteed to be write-once, run-anywhere language.
On compilation Java program is compiled into bytecode. This bytecode is platform independent and can be run on any machine, plus this bytecode format also provide security. Any machine with Java Runtime Environment can run Java Programs.
When it comes to security, Java is always the first choice. With java secure features it enable us to develop virus free, temper free system. Java program always runs in Java runtime environment with almost null interaction with system OS, hence it is more secure.
6) Multi Threading
Java multithreading feature makes it possible to write program that can do many tasks simultaneously. Benefit of multithreading is that it utilizes same memory and other resources to execute multiple threads at the same time, like While typing, grammatical errors are checked along.
7) Architectural Neutral
Compiler generates bytecodes, which have nothing to do with a particular computer architecture, hence a Java program is easy to intrepret on any machine.
Java Byte code can be carried to any platform. No implementation dependent features. Everything related to storage is predefined, example: size of primitive data types
9) High Performance
Java is an interpreted language, so it will never be as fast as a compiled language like C or C++. But, Java enables high performance with the use of just-in-time compiler.
Chapter 1: Introduction to Java programming
a) The Java Virtual Machine
A Java virtual machine (JVM) is a virtual machinethat enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally describes what is required of a JVM implementation.
b) Variables and data types
data types : byte, short, int, long, float, double, boolean, and char
Variables types : local variable, instance variable, static variable
c) Conditional and looping constructs
conditional constructs are features of a programming language, which perform different computations or actions depending on whether a programmer-specified boolean condition evaluates to true or false.
Looping Constructs (Controlling Programming Flow) The statements inside any program executes sequentially, lineby line. This flow of execution is called as sequential execution.This flow of execution can be controlled (for example: Execute aportion of a program only once, based on a condition.
Java array is an object which contains elements of a similar data type. It is a data structure where we store similar elements. We can store only a fixed set of elements in a Java array. Array in java is index-based, the first element of the array is stored at the 0 index.
Chapter 2: Object-oriented programming with Java Classes and Objects
a) Fields and Methods
Fields and methods are alike in that they exist within classes and have a defined type. If a method returns no values, its type is set to void. The most important distinction between the two is that Java fields can hold information, while Java methods perform a task.
Constructors in Java. A constructor is a special method that is used to initialize an object.Every class has a constructor,if we don’t explicitly declare a constructor for any java class the compiler builds a default constructor for that class. A constructor does not have any return type.
c) Overloading methods
Two or more methods can have same name inside the same class if they accept different arguments. This feature is known as method overloading.
Method overloading is achieved by either: changing the number of arguments. …
Method overloading is not possible by changing the return type of methods.
d) Garbage collection
Java garbage collection is the process by which Java programs perform automatic memory management. Java programs compile to bytecode that can be run on a Java Virtual Machine, or JVM for short. … The garbage collector finds these unused objects and deletes them to free up memory.
e) Nested classes
The Java programming language allows you to define a class within another class. Such a class is called a nested class
Chapter 3: Inheritance
a) Overriding methods
Method overriding, in object-oriented programming, is a language feature that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its superclasses or parent classes.
Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. Any Java object that can pass more than one IS-A test is considered to be polymorphic.
c) Making methods and classes final
Writing Final Classes and Methods. You can declare some or all of a class’s methods final. You use the final keyword in a method declaration to indicate that the method cannot be overridden by subclasses. The Object class does this—a number of its methods are final
d) Abstract classes and methods
An abstract class is a class that is declared abstract —it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed. When an abstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class.
An interface in the Java programming language is an abstract type that is used to specify a behavior that classes must implement. They are similar to protocols. Interfaces are declared using the interface keyword, and may only contain method signature and constant declarations
Chapter 4: Exception handling with try-throw-catch-finally constructs
a) The Exception class
Exception is an error event that can happen during the execution of a program and disrupts its normal flow. Java provides a robust and object oriented way to handle exception scenarios, known as Java Exception Handling.
Chapter 5: The Object class
a) Cloning objects
Object clone() method only when your class has primitives and immutable variables. Note that this applies for with inheritance too. You will have to check all the classes you are extending till the Object level. You can also define copy constructor if your class mostly consists of mutable objects.
b) The JDK LinkedList class
The LinkedList class also consists of various constructors and methods like other java collections. Constructors for Java LinkedList: … LinkedList(Collection C): Used to create a ordered list which contains all the elements of a specified collection, as returned by the collection’s iterator.
a string is an object that represents a sequence of characters. The java.lang.String class is used to create string object. There are two ways to create a String object: By string literal : Java String literal is created by using double quotes.
d) String conversions
Integer.toString(int i) is used to convert in the further direction, from an int to a Java String. If you’re concerned with converting a String to an Integer object, use the valueOf() method of the Integer class instead of the parseInt() method.
Chapter 6: Working with types: Wrapper classes
a) Enumeration interface
An object that implements the Enumeration interface generates a series of elements, one at a time. Successive calls to the nextElement method return successive elements of the series.
Chapter 7: Packages
a) Package access
A Java access modifier specifies which classes can access a given class and its fields, constructors and methods. … Classes, fields, constructors and methods can have one of four different Java access modifiers: private. default (package) protected.
b) Documentation comments
Javadoc is a documentation tool which defines a standard format for such comments, and which can generate HTML files to view the documentation from a web broswer.
Chapter 8: Applets
a) Configuring applets
An applet is a Java program that runs in a Web browser. An applet can be a fully functional Java application because it has the entire Java API at its disposal. An applet is a Java class that extends the java.applet.Applet class. A main() method is not invoked on an applet, and an applet class will not define main().
b) Applet capabilities and restrictions
A java applet is program that can be included in a HTML page and be executed in a java enabled client browser. Applets are used for creating dynamic and interactive web applications.
An applet cannot load libraries or define native methods.
An applet cannot ordinarily read or write files on the execution host.
An applet cannot read certain system properties.
An applet cannot make network connections except to the host that it came from.
An applet cannot start any program on the host that’s executing it.
Chapter 9: Basics of AWT and Swing
a) Layout Managers
The LayoutManagers are used to arrange components in a particular manner. LayoutManager is an interface that is implemented by all the classes of layout managers. There are following classes that represents the layout managers: java.awt.BorderLayout.
b) Event Handling
Event Handling is the mechanism that controls the event and decides what should happen if an event occurs. This mechanism have the code which is known as event handler that is executed when an event occurs. Java Uses the Delegation Event Model to handle the events. … Java provide as with classes for source object.
c) The Action Listener interface
A button listener must implement the ActionListener interface. ActionListener is an interface (not a class) that contains a single method: … A class that implements the interface must contain an actionPerformed() method. The ActionEvent parameter is an Event object that represents an event (a button click).
The class Panel is the simplest container class. It provides space in which an application can attach any other component, including other panels. It uses FlowLayout as default layout manager.
e) Checkbox, etc.
Java AWT Checkbox. The Checkbox class is used to create a checkbox. It is used to turn an option on (true) or off (false). Clicking on a Checkbox changes its state from “on” to “off” or from “off” to “on”.
f) Dialogs and frames
When the frame is deiconified, its dependent Dialogs return to the screen. A swing JDialog class inherits this behavior from the AWT Dialog class. A Dialog can be modal. When a modal Dialog is visible, it blocks user input to all other windows in the program. JOptionPane creates JDialog s that are modal.
g) Using menus
Menus Java are a number of pull-down combo boxes (In Java called as Choice) placed at single place for easy selection by the user. To create menus, the java.awt package comes with mainly four classes – MenuBar, Menu, MenuItem and CheckboxMenuItem.
h) Using the adapter classes
Java Adapter Classes. Java adapter classes provide the default implementation of listener interfaces. If you inherit the adapter class, you will not be forced to provide the implementation of all the methods of listener interfaces. So it saves code.
The Graphics class is the abstract super class for all graphics contexts which allow an application to draw onto components that can be realized on various devices, or onto off-screen images as well. A Graphics object encapsulates all state information required for the basic rendering operations that Java supports.
Chapter 10: Threads
Synchronized keyword in Java is used to provide mutually exclusive access to a shared resource with multiple threads in Java. Synchronization in Java guarantees that no two threads can execute a synchronized method which requires the same lock simultaneously or concurrently.
Chapter 11: The I/O Package
a) InputStream and OutputStream classes
The InputStream is used to read data from a source and the OutputStream is used for writing data to a destination. Here is a hierarchy of classes to deal with Input and Output streams. The two important streams are FileInputStream and FileOutputStream,
b) Reader and Writer classes
The java.io.Writer class specifies the API by which characters are written. Wherever input and output streams use bytes, readers and writers use Unicode characters. … The most important concrete subclasses of Reader and Writer are the InputStreamReader and the OutputStreamWriter classes.
Chapter 12: Basic concepts of networking
a) Working with URLs
The Network API makes it possible to work with URLs at the source code level by providing class URL (located in package java.net). Each URL object encapsulates a resource’s identifier with a protocol handler
Java Socket Programming. A socket is one endpoint of a two-way communication link between two programs running on the network. Socket is bound to a port number so that the TCP layer can identify the application that data is destined to be sent.
Chapter 13: Database connectivity with JDBC
a) Java security Java security technology includes a large set of APIs, tools, and implementations of commonly used security algorithms, mechanisms, and protocols. The Java security APIs span a wide range of areas, including cryptography, public key infrastructure, secure communication, authentication, and access control.