Top 6 Parts of antanomy of java programming

Antinomy is a word that means a study of the structure or internal working of something.
Here we are talking. The antonym of Java programming means what is written in the outer view of the Java program structure. in Java programming
We use object-oriented concepts, such as object, class, inheritance, polymorphism, abstraction, etc.

 

Now I want Let Discurs Top 6 Parts in Antinomy of Java Programing :

1. Documentation section 
2. Package statement 
3.  Import statement 
4. Interfaces 
5. Class definition 
6. Main method

Now the explanation of those parts:

 

1. Documentation section :


JavaDoc tool is a document generator tool in Java programming language for generating standard documentation in HTML format. It generates API documentation. It parses the declarations ad documentation in a set of source files describing classes, methods, constructors, and fields.

Before using the JavaDoc tool, you must include JavaDoc comments /**………………..*/ providing information about classes, methods, constructors, etc. For creating a good and understandable document API for any java file, you must write better comments for every class, method, constructor.
JavaDoc Format: – 
It has two parts: – a description which is followed by block tags.
Some Integrated Development Environments (IDE) automatically generate the JavaDoc file like NetBeans, IntelliJ IDEA, Eclipse, etc.

 

Generation of JavaDoc: – 
To create a JavaDoc, you do not need to compile the java file. To create the Java documentation API, you need to write Javadoc followed by file name. 

javadoc file_name or javadoc package_name

After successfully executing the above command, several HTML files will be created; open the file named index to see all the information about classes.

 

2. Package statement :


A java package is a group of similar types of classes, interfaces, and sub-packages.

Package in java can be categorized in two forms, built-in package, and user-defined package.
There are many built-in packages such as java, lang, awt, java, swing, net, io, util, SQL, etc.
Here, we will have the detailed learning of creating and using user-defined packages.

The package statement identifies the package that a Java program belongs to. ... The syntax of the package statement is simple: package package-name; Package-name refers to the name of the package that the program should be added to.

 

3. Import statement:


 An import statement tells Java which class you mean when you use a short name (like List). It tells Java where to find the definition of that class.

You can import just the classes you need from a package, as shown below. Just provide an import statement for each class that you want to use.
import java.util.List; // import just the List interface import java.util.ArrayList; // import just the ArrayList class 
Another option is to import everything at the same level

The import statement can import an entire package or sometimes import certain classes and interfaces inside the package. The import statement is written before the class definition and after the package statement(if there is any). Also, the import statement is optional.

 

4. Interfaces:


An interface in Java is a blueprint of a class. It has static constants and abstract methods.

The interface in java is a mechanism to achieve abstraction. It is used to achieve abstraction and multiple inheritances in Java. There can be only abstract methods in the Java interface, not the method body.

In other words, you can say that interfaces can have abstract methods and variables. It cannot have a method body.

 

5. Class definition :


A class is a blueprint from which individual objects are created.

Following is a sample of a class.

Example

public class Dog { 
String breed; 
int age; 
String color; 
void barking() { 
}
 void hungry() {
 }
 void sleeping() { 
} } 

 

A class can contain any of the following variable types.

Local variables − Variables defined inside methods, constructors, or blocks are called local variables. The variable will be declared and initialized within the method, and the variable will be destroyed when the method has been completed.

Instance variables − Instance variables are variables within a class but outside any method. These variables are initialized when the class is instantiated. Instance variables can be accessed from inside any method, constructor, or block of that particular class.

Class variables − Class variables are variables declared within a class, outside any method, with the static keyword.

 


String args[]: The main() method also accepts some data from the user. 6. Main method:


main(): It is a default signature that is predefined in the JVM. It is called by JVM to execute a program line by line and end the execution after completion of this method. We can also overload the main() method.
Java main() method is always static, so that compiler can call it without creating an object or before the creation of an object of the class. The main() method is the starting point from where the compiler starts program execution in any Java program.

Enjoyed this article? Stay informed by joining our newsletter!

Comments

You must be logged in to post a comment.

About Author