Java is a Programming Language that was created by James Gosling at Sun Microsystems(which is now been acquired by Oracle) and was first released on May 23, 1995. It is known as a “high-level” language because it is easy to read and write by Humans. Java also has a set of rules which should be followed to write a successful program. These rules are known as syntax. Also to mention that Java is case sensitive which means that there are certain commands which sometimes cannot be written in UPPERCASE or lowercase and may have both cases, so you need to be very careful with that. Java files take .java
extension.
Key Principles of Java:
Easy to Use: Java is a very powerful programming language that is very simple & easy to use.
Reliability: Java is very robust as both Data and its manipulation are packed together in one place. The Java environment has hundreds of classes and methods under different packages to help software developers like us. For example,
java.lang
- for advanced features of strings, arrays etc.
java.io
- for file i/o, exception handling etc.
java.util
- for data structures, regular expressions, etc.Secure: Java has a high level of security included. which makes it one of the most secure programming languages to date.
Platform Independent: The Java Compiler compiles the source code of the program into machine language which is then converted to byte code which can be interpreted and executed with the help of JVM(Java Virtual Machine). This byte code can easily be read across different platforms, thus making Java Platform Independent.
An Object-Oriented Language: There are different styles of programming. The object-oriented approach is one of the popular programming styles. In object-oriented programming, a complex problem is divided into smaller sets by creating objects. This makes your code reusable, has design benefits, and makes code easier to maintain.
Some Basic Concepts:
Compiler: A compiler is a program that converts the source code of the program into machine language. As Java works across platforms, it compiles the source code into a special code called byte code.
Byte Code: A compiler converts the source code of the program into machine language code, this machine language is converted to byte code. It is in Unicode format and can be interpreted and executed by the Java Virtual Machine.
JVM(Java Virtual Machine): A Java Virtual Machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled into Java byte code. JVMs are available for many hardware and software platforms. The use of the same byte code for all JVMs on all platforms allows Java to be described as a “compile once, run anywhere” programming language. Thus, the JVM is a crucial component of the Java Platform.
Java Application:
(a)Java Application is a standalone program that contains the main method. It is executable on any platform.
(b)Java Applets are Java programs that are executable using a web page by a web browser on the machine. It does not have a main method.
(c)Java Servlet is an applet that runs on the server side. It does not have a main method.Java Character Set: Java uses the Unicode Character Set. Each Unicode character is defined by 16 bits(2 bytes). Unicode represents almost all alphabets from various languages.
ASCII Codes: The American Standard Code for Information Interchange(ASCII) is a character-encoding scheme originally based on the English alphabet. ASCII codes represent sent text in computers, and other devices that use text. Most modern character-encoding schemes are based on ASCII and they support many additional characters. You can see some of them in these links.
Java Development Kit: Java Development Kit(JDK) provides several tools which are essential to develop and run Java Programs. Java has a large number of classes available, which come with JDK. These classes implement the handling of text, graphics, mathematical functions, etc.
Tokens: The smallest individual unit in a program is known as a token. Java offers some of the following tokens:
(a)Keywords — These are the reserved words in Java that have a special meaning.
(b)Identifiers — All Java components require names. Names used for classes, variables and methods are called identifiers.
(c)Literal or Constants — A literal is a source code representation of a fixed value. They are represented directly in the code without any computation. Literals can be assigned to any primitive type variable. E.g.:
byte a = 68;
char a = 'A';
String literals in Java are specified like they are in most other programming languages by enclosing a sequence of characters between a pair of double quotes. E.g.:
"Hello World"
"The line breaks \n here"
Java supports a few special escape sequences for String and char literals as well. They are:-
(a) \n - It creates a new line
(b) \s - It creates a space
(c) \t - It creates a tab
(d) \" - It creates a double quote
(e) \' - It creates a single quote
(f) \\ - It creates a backslash.
(d)Separator or Punctuator - These are exactly nine single-character separators in Java. These are:
( ) { } [ ] ; , .
(e)Operators - An operator is a symbol that tells the compiler or interpreter to perform specific mathematical, relational or logical operations and produces the final result. There are a total of 37 operators included in Java.Comments in Java: Java supports single-line and multi-line comments. All characters available inside-any comment are ignored by the Java compiler.
That’s it for Today. I hope you liked It. Next Time I will be sharing more information about the Java Programming Language. Thank You!
Reference:
1. ICSE Java COMPLETE REFERENCE (by Swapnil Karmalkar).
2. Wikipedia.
About the Author: Hello my name is Syed Md Mihan Chistie, I am a Student Developer and love coding. I am creating this post so that it helps you as well as me to know more about Java. Since Java is so Versatile.
Till Then, Happy Coding!