StudyWithGenius

INTRODUCTION TO JAVA PROGRAMMING

Introduction To Java Programming_StudyWithGenius

INTRODUCTION TO JAVA PROGRAMMING: Java is a platform as well as a programming language. Java is a high-level programming language that is also robust, object-oriented, and secure. Java is a high-level programming language that is also robust, object-oriented, and secure.

Java was created in 1995 by Sun Microsystems (which is now a division of Oracle). The founder of Java, James Gosling, is recognized as the “Father of Java.” It was known as Oak before Java.Since Oak was already a registered company, so James Gosling and his team changed the Oak name to Java.

A SIMPLE JAVA PROGRAM
public class HelloWorld
{
  public static void main(String[]args)
   {
    System.out.println("Hello,World!");
   }
}

A CLOSER LOOK AT THE HELLO WORLD PROGRAM:

public class HelloWorld{The class keyword begins the class definition for a class named HelloWorld. Every Java application contains at least
one class definition (Further information about classes will be provided later).
public static void main(String args[])This is an entry point method (defined by its name and signature of public static void main(String[])) from
which the JVM can run your program. Every Java program should have one. It is:
public: meaning that the method can be called from anywhere mean from outside the program as well. See Visibility for more information on this.
static: meaning it exists and can be run by itself (at the class level without creating an object).
void: meaning it returns no value. Note: This is unlike C and C++ where a return code such as int is expected (Java’s way is System.exit ()).

This main method accepts:
An array (typically called args) of Strings passed as arguments to main function (e.g. from command line arguments).
Almost all of this is required for a Java entry point method.

NON-REQUIRED PARTS:

  • The name args is a variable name, so it can be called anything you want, although it is typically called args.
  • Whether its parameter type is an array (String[] args) or Varargs (String… args) does not matter because arrays can be passed into varargs.

Note: A single application may have multiple classes containing an entry point (main) method. The entry point of the application is determined by the class name passed as an argument to the java command.

Inside the main method, we see the following statement:

System.out.println(“Hello, World!”); Let’s break down this statement element-by-element:

ELEMENT PURPOSE
Systemthis denotes that the subsequent expression will call upon the System class, from the java.lang package.
.
this is a “dot operator”. Dot operators provide you access to a classes members1; i.e. its fields (variables) and its methods. In this case, this dot operator allows you to reference the out static field within the System class.
outthis is the name of the static field of PrintStream type within the System class containing the
standard output functionality.
.this is another dot operator. This dot operator provides access to the println method within the out variable.
printlnthis is the name of a method within the PrintStream class. This method in particular prints the contents of the parameters into the console and inserts a newline after.
(this parenthesis indicates that a method is being accessed (and not a field) and begins the parameters being passed into the println method.
“Hello,World!”this is the String literal that is passed as a parameter, into the println method. The double quotation marks on each end delimit the text as a String.
)this parenthesis signifies the closure of the parameters being passed into the println method.
;this semicolon marks the end of the statement.
}
end of main function scope.
}end of class HelloWorld scope

JVM(JAVA VIRTUAL MACHINE)

JVM (Java Virtual Machine) is a machine that is abstract. Because it does not exist physically, it is called a virtual machine. It’s a specification that creates a runtime environment for Java bytecode to run in. It can also run applications that have been compiled to Java bytecode from other languages.

For a wide range of hardware and software platforms, JVMs are available. Because each OS’s configuration is different, JVM, JRE, and JDK are platform dependent. Java, on the other hand, is platform agnostic. The JVM is divided into three categories: specification, implementation, and instance.

JVM is-

  • A standard that describes how the Java Virtual Machine works. The implementation supplier, on the other hand, is free to determine the algorithm. Oracle and other companies have helped with its adoption.
  • A process of implementation JRE is the name of the programme that implements it (Java Runtime Environment).
  • Instance at Runtime When you type java on the command prompt to launch a java class, a JVM instance is created

.an introduction to programming in java an introduction to programming using java introduction about java programming introduction about java tutorial

Leave a Comment

Your email address will not be published. Required fields are marked *

X