Java Networking is a concept of connecting two or more computing devices together so that we can share resources. The java.net package of the J2SE APIs contains a collection of classes and interfaces that provide the low-level communication details. Java socket programming provides facility to share data between different computing devices. The java.net package provides […]
Java
Java – Documentation Comments
The Java language supports three types of comments: /* text */ – The compiler ignores everything from /* to */. //text – The compiler ignores everything from // to the end of the line. /** documentation */ – This is a documentation comment and in general its called doc comment. The JDK javadoc tool uses […]
Java Applet Basics
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. The applet is a special type of program that is embedded in the webpage to generate dynamic content. It runs inside the browser and […]
Java – Multithreading
Multithreading is a Java feature that allows concurrent execution of two or more parts of a program for maximum utilization of CPU. Each part of such a program is called a thread. Multitasking is when multiple processes share common processing resources such as a CPU. Each of the threads can run in parallel. The OS […]
Java – Sending Email
To send an e-mail using your Java Application is simple enough but to start with you should have JavaMail API and Java Activation Framework (JAF) installed on your machine. Download and unzip these files, in the newly created top-level directories, you will find a number of jar files for both applications. You need to add […]
Java Interfaces
Writing an interface is similar to writing a class. But a class describes the attributes and behaviors of an object. And an interface contains behaviors that a class implements. An interface is similar to a class in the following ways: An interface is written in a file with a .java extension, with the name of […]
Java Packages
A Package can be stated that a grouping of related types (classes, interfaces, enumerations, and annotations ) providing access protection and namespace management. Some of the existing packages in Java are: java.io – classes for input , output functions are bundled in this package. java.lang – bundles the fundamental classes. Creating a Package The package […]
Java Encapsulation
Encapsulation is a more useful fundamental OOP concept. The other three are inheritance, polymorphism, and abstraction. Encapsulation in Java is data variables and methods together as a single unit. In encapsulation, the variables of a class will be hidden from other classes, and can be accessed only through the methods of their current class. Therefore, […]
Java Abstraction
An abstract method is a method that is declared without an implementation (without braces, and followed by a semicolon): abstract void walk();. The user will have the information on what the object does instead of how it does it. Abstract Class Abstraction is achieved using abstract classes and interfaces. To use an abstract class, you […]
Java Polymorphism
Polymorphism, which refers to the idea of “having many forms”, occurs when there is a hierarchy of classes related to each other through inheritance. A call to a member method will cause a different implementation to be executed, depending on the type of object invoking the method. Dog and Cat are classes that inherit from […]