Java Introduction

What are the features in Java?

  • Java is a high-level programming language originally developed by Sun Microsystems and released in 1995.
  • Java is platform independent language and runs on a variety of platforms, such as Windows, Mac OS, and UNIX.
  • Object Oriented - Java supports the object oriented programming language and everything is object and features developed in java which can be easily extended.
  • Platform Independent − Java is compiled into platform independent byte code. This byte code is distributed over the web and interpreted by the Java Virtual Machine (JVM) on whichever platform it is being run on. (Write once, run anywhere)
  • Portable − Architecture-neutral and having no implementation dependent aspects of the specification makes Java portable. carry and run the java bytecode in any platform.
  • Robust − Eliminate error prone situations by emphasizing mainly on compile time error checking and runtime checking.
  • Multithreaded − It is possible to write programs that can perform multiple tasks simultaneously.
  • Interpreted − Java byte code is translated on the fly to native machine instructions and is not stored anywhere. The development process is an incremental and light-weight process.
  • High Performance − Java uses Just-In-Time compilers and provides high performance
  • Distributed − Designed for the distributed environment of the internet.
  • Dynamic − Java is considered to be more dynamic and programs can carry extensive amount of run-time information that can be used to verify and resolve accesses to objects on run-time.
  • Secure - Execution of every java program is under the control of the JVM. JVM can contain the program and prevent it from generating side effects outside of the system.

How to install Java on Linux environment?

Java installation:Download Java SE Development Kit 8 RPM from the link.
Install the downloaded RPM by running linux command
# Change current user to root user.
$ su -

# installs RPM in fedora, here /home/user dir is the rpm file downloaded location.
# rpm -Uvh /home/user/jdk-8u144-linux-x64.rpm  
JDK installer for different environments like windows, Mac OS and Solaris can be downloaded in link

Java Program Example:

// Sample Java code
public class Example {

   public static void main(String []args) {
      System.out.println("Welcome!");
   }
} 

How to compile and run java program?

c:\Java_code> javac Example.java
C:\Java_code> java Example 
Welcome!

Javac compiler translates Example.java file into Example.class file that contains the bytecode version of the program. Example.class file cannot be directly executed.

To execute the Example.class, must use the java interpreter (java command). Java command interprets and executes the compiled java code.

What is Java history?

Originally developed by James Gosling at Sun Microsystems(which has since been acquired by Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform

What does Java compiler?

Create the java program in .java file and then compile the program using javac command.
Compiler checks program against the java language syntax rules, then converts into bytecode in .class files. Bytecode is a set of instructions targeted to run on a Java virtual machine (JVM).
Translating java program into bytecode makes it mush easier to run a program in a wide varity of environments.
Java compiler writes out instruction(bytecode) is suitable for CPU processor.

What is Java Platform?

A platform is the hardware or software environment in which a program runs. Java platform is a software-only platform that runs on top of other hardware-based platforms.
Two components:
  • Java Virtual Machine (JVM): This is Virtual Machine, base for the Java platform and is ported onto various hardware-based platforms. At runtime, JVM interprets .class files and executes the program's instructions on the native hardware platform where JVM runs.
    JVM is a software written specific to any particular platform. only JVM needs to be implemented for each platform
  • Java Application Programming Interface (API): API is a large collection of predefined software components and grouped into libraries of classes and interfaces. this libraries are also called packages.

What is Garbage Collector in java?

Java supports implicit memory management and it is one of the important features in java.
Java code creates an object instance at runtime, the JVM automatically allocates memory for that object from the heap. Java garbage collector runs in the background, keeping track of which objects are no longer needs. and cleans memory from objects which will not be needed.

What is Java Development Kit?

JDK contains compiler, other tools and complete class library of prebuilt utilities that is used for most common application development tasks.

What is Java Runtime Environment?

JRE contains JVM, libraries, and components that are required to run java programs.
JRE is available for multiple platforms.

What is just-in-time compiler?

Compilation is done during execution of a program at run time rather than prior to execution.
Component of the JRE and improves the performance of Java code at run time.
JIT compiler is enabled by default, and is activated when a Java method is called and compiles the bytecodes of that method into native machine code.
Java Examples

GCD and Rational Number Java Program

Java Queue Program using exception

Java Stack Program using exception

Addition of three integers java program

Biggest of three integers java program

Fibonacci numbers java program

Arithmetic Operations Menu java program

Second Smallest Element In Array Java Program

Transpose Of A Matrix Java Program

Java Program to Display triangle of stars (*)

Java Programming Prints Product Tables

Java Program to Display triangle of numbers

Java Program to Get Current Date

Java Program to Find Character Vowel or Consonent

Java Program to Compute HCF and LCM

Java Program to Sum the Command Line Integer Arguments

Java Programm to Multiply the Command Line Integer Arguments

Java Program to Find Multiplication of Command Line Floating Point Numeric Arguments

Java Program to Check String Contains or Not

Java Program to Get Grade Description using Switch

Java Program for CSV File Reader

Java Program to Find Character Frequency Count in String using for each

Java Program to Find Min from Integer Array by Passing Array to Method

Java Program Linear Search

Binary Search Java Program

Ternary Search Java Program

Java Program to Generate Range of Numbers

Java Program to Generate Range of Characters

Java Program to Compute Square Root Value

Java Program to Check Number is Positive or Negative

Java Program to Check Number is Odd or Even

Java Program to Compute Plot Area

Java Program to Convert Number of Days into Years

Java Program to Check a Year is Leap Year, Century Year or Not

Java Program to Check a Character is Digit, Letter or neither digit nor letter

Java Program to Check a Number is Palindrome or not

Java Program to Sum Two Matrix

Java Program to Compute Power

Java Program to Check Number is an Armstrong Number or not

Java Program for Temperature Unit Conversions

Java Program to Generate Random Numbers in Specified Range

Java Program to Compute Sum of Digits and Product of Digits

Java Program to Compute Reverse Number

Java Programming Computes Factorial Value

Java Programming Checks Prime Number or not

Java Program to Compute Harmonic Series

Java Program Generate Floyd's Triangle

Java Program to Reverse String

Java Program to Check Palindrome String or not

Java Program to Open Notepad

Java Program to Search String using RegEx Pattern

Java Program to Search Word in String

Java Program to Get System Environment Variables

Java Program to Get IP Address of Server Name

Java Program for Arrays Sorting and Reverse using sort method

Java Program for Bubble Sorting

Java Program for Selection Sorting

Java Program for Insertion Sorting

Java Program for Merge Sorting

Java Program for Quick Sorting

Java Program for Counting Sort

Java Program for Radix Sorting

Java Program for Sorting Array of Strings

Java Program for String Characters Sorting

Java Program to Sum First N Numbers

Java Program to Product First N Numbers

Java Program to get URL details

Java Program to get URL HTML Content

Java Program to get URL details

Java Program to get URL HTML Content

Privacy Policy  |  Copyrightcopyright symbol2020 - All Rights Reserved.  |  Contact us   |  Report website issues in Github   |  Facebook page   |  Google+ page

Email Facebook Google LinkedIn Twitter
^