Run Java Application with Docker Docker provides official images to run Java program on command line. You can run Java programs without installing Java on your system. This will be helpful to you choose any version of Java during program execution. This tutorial will help you to run a sample java program using Docker containers. Run Java Program with Docker The below steps will help you to create a sample Java program. then create a Dockerfile to run a Java program under the docker container. After that build a custom…
Read MoreTag: java
Difference between C and Java
Difference between C and Java Here are the few key differences between C and Java programming languages. # C JAVA 1 C is a procedure Oriented Language. Java is an object-oriented programming language. 2 C compiles the source code to machine code. Java compiles the java byte code. 3 C support goe to statement. Java does not support go to statement. 4 In C language, Pointers are very commonly used. Java does not have an explicit pointer data type. 5 C doesn’t support method overloading. Java support method overloading. 6…
Read MoreJava Keywords
Keywords in Java Keywords are the words that have a standard, predefined meaning. These keywords can be needed only for their intended purpose; the programmer cannot redefine them. All keywords must be written in lowercase. The keywords are also known as Reserved Words. These are 49 keywords in Java as shown in the table: abstract double int switch asset else interface synchronized boolean extends long this break false native throw byte final new transient case finally package true catch float private try char for protected void class goto public volatile…
Read MoreJava Tokens
Tokens in Java Tokens are the smallest or atomic elements of a language. A Java program can be written using tokens, white spaces and the syntax of the language. Java has the following tokens: 1. Keywords 2. Identifiers 3. Literal 4. Operators 5. Separator White space is defined as a blank space, tab, carriage return, form feed, and newline. The compiler ignores the white space. White spaces are used to separate tokens. For example, white space is required between two adjacent tokens like an identifier and an operator for better…
Read MoreInheritance and Polymorphism
Inheritance in Java The mechanism of deriving a new class from an old one is called Inheritance. The old class is called the base class or superclass or parent class, and the new one is called the subclass or derived class or child class. Advantage of Inheritance Here is the list of key advantages of inheritance in Java programming language. 1. Reusability: The main advantage of inheritance is Reusability. Reusability means that we can add additional features of an existing class without modifying it. 2. Time-Saving: The above concept of…
Read MoreArrays
Arrays in Java Arrays are a data structure which holds multiple values of the same data type. An array is a sequence of objects all of which have the equal type. The objects are called elements of the array and are a numbered consecutively 0,1,2,…. These numbers are called index values or subscripts of the array. The term “subscript” is used because as a mathematical sequence, an array would be written with subscripts: Here 0, 1, 2, are the subscripts of variable x.Java provides another way to represent such types…
Read MoreVariables and Datatypes
Java – Variables and Datatypes A programming language is designed to process data. The function of processing data is accomplished by executing a sequence of instructions constituting a program. An instruction is formed by using certain symbols and words according to the syntax rules of the language. Java is also a programming language; therefore, it has its vocabulary and grammar. In this topic, we will discuss tokens, constants, variables and data types related to the Java language. Java Character Set Java is written in UNICODE a 16-bit character coding systems…
Read MoreFeatures of Java
Features of Java Java is a feature-rich programming language. Here is a list of the features in Java. 1. Simple: Java is easy to write and understand. Java programmer does not have to work with pointer and does not need to manage memory explicitly. Its virtual machine handles memory management. Java also eliminates operator overloading and multiple inheritances. 2. Java is Object Oriented: Java is a fully object-oriented language which follows all the rules of OOPS like inheritance, abstraction, polymorphism, etc. and everything can be treated in the form of…
Read MoreHistory of Java
History of Java Java was developed by James Gosling, Patrick Naughton, Chris Warth, Ed Frank, and Mike Sheridan in 1991 at Sun Microsystems. It was initially called ‘oak’ but was renamed as Java in 1995. Oak is a pattern of strength and chosen as a national tree of many countries like the U.S.A., France, Germany, Romania, etc. In 1995, Oak was renamed as “JAVA” because it was earlier a trademark by Oak Technologies. Java is an island of Indonesia where first coffee was produced (called coffee). Java Release History The…
Read MoreMethod Overloading
What is Method Overloading? Using multiple methods with the same name and different parameters is known as method overloading in Java. You can create multiple methods with the same name in a Java program, but all these methods differ with the number of parameters or data types. This is called Method Overloading in Java. The parameters for overloading functions may differ with three types: 1. Number of parameters –
1 2 | sum(int x, int y) sum(int x, int y, int z) |
2. Datatype of Parameters –
1 2 | sum(int x, int y) sum(int x, char y) |
3. Sequence of Datetype of parameters –
1 2 | sum(int x, float y) sum(float x, int y) |
Running Example of Method Overloading Here…
Read More