Free Data Structures and Algorithms Course

Subscribe below and get all best seller courses for free !!!


Subscribe to all free courses

What are basic fundamentals of Java programming language ?.

Java is a very versatile language. It is the language of future on the programming perspective. In this tutorial hub I will be providing you with Java fundamentals. If we talk about Java fundamentals we basically deal with the syntax and semantics of the language. Some of the fundamentals of language are been described below :
  • Whitespace
When dealing with whitespace generally syntax rules come into picture. Whitespace characters such as tabs, newlines and spaces in a program makes our code easier to read. Generally whitespace characters are ignored by the Java compiler. So even if we use large chunks of whitespace in our code compiler ignores them and thus byte code generated is small , having no impact on memory. Generally we should be careful enough to use whitespace because excessive use can make code unreadable.
  • Styles
Styles has to deal with the formatting of the source codes. Generally we format a Java file so that it becomes easier to read. In order to format a Java file we need to look at style guidelines. Style guidelines are mainly standards followed by company, organization or individual. Generally when setting guidelines developers keep in mind formatting of code which is eaiser to read. These formatting is ignored by the compiler. Styles include use of indentation, spacing and newlines which formats source codes as per developers. Comments are used to format code and add notes so that any other programmer reading the code gets the idea behind the code.

// Bad Style Coding
// Very hard to read, no indents used

public class Welcome {
public static void main(String[] args){
int i = 0; // single line comment
for(int i=0;i<=10;i++){
int j = 1;
int k = j;
System.out.println("Welcome to comments"); 

// Good Style Coding
// Very easy to read, excellent use of indents

public class Welcome {
  public static void main(String[] args){
    int i = 0; // single line comment
    for(int i=0;i<=10;i++){
      int j = 1;
      int k = j;
      System.out.println("Welcome to comments"); 

  • Comments
Comments are important elements of any programming language. Comments provide us a way to insert notes in a source code. They make us understand a complex code without going into much depth of the code. They make source code easier to debug. Also they are ignored by the compiler so we have no issues related to memory. There are mainly 2-3 types of Java comments Single line comment and multi-line comment. A single line comment as the name suggest comments out single line. It starts with a double forward slash //. In a Java program anything that we write after // slashes gets ignored by the compiler till the end of the line. You can also use multi-line comment which starts with /* and ends with */. Many developers use this type of comment when they have to comment out a block of code. This multi-line comment can go through many lines of code.

public class Welcome {
  public static void main(String[] args){
    int i = 0; // single line comment
    for(int i=0;i<=10;i++){
     /* int j = 1;
        int k = j;
        System.out.println("Welcome to comments"); */ 
     /* multi-line comment, whole code between is commented out */ 

  • Identifiers

Identifiers are names given to variables , class , methods in a Java source code. There are rules imposed on the naming conventions of Java identifiers. The rules are as follows:
  1. An Identifier must begin with a unicode character, dollar sign or underscore.
  2. After the first character you can add numbers along with unicode characters, dollar sign and underscore.
  3. Generally use of currency symbols such as dollar sign should be avoided.
  4. Java identifiers are Case-sensitive.
  5. Java identifiers should not be a reserved keyword of Java.
  6. Capital letters should be used to separate two words.
  • Reserved Keywords
In Java there are several words which are reserved by the language and cannot be used for naming identifiers. The list of such keywords are :
  • Separators
Separators are highly used in Java programming language. Each separator has its own significance. Lets look some of the separators and their characteristics:-
  • Literals
Other than separators Java also uses literals. Literals give us a brief idea about the data types. Let us view them in a tabular form
  • Escape Sequences
Escape Sequences are generally used in Strings to give a particular character a escape. Let us see one by one in a tabular form.
Escape Sequences in Java video :- 

    Why Java is a complete programming platform ?

    Java is certainly best programming language available to serious programmers out there. It is one of the best and most widely used programming language. Java is a powerful language with great features. Talking in terms of technology, Java is not a language, it is a full featured platform. If we talk about high level features then Java platform contains a wide variety of Java Libraries. These libraries has lot of useful reusable code already written. It also has execution environment within it which provides security, simplicity, portability. Its one good feature is automatic garbage collection which makes Java easier to use. If we talk about some other features then this language provides huge API’s (Application Programming Interface) , great syntax and semantics to code. It has everything that makes it a language to get addicted.
    Java has very wide features. Many of the features provides the language power to code applications, software and services.

    Watch this video tutorial below :-

    Some of the characteristics or say features of Java are as follows:-
    • Simple
    Java was developed to have a language which is simple and programmed easily. Java was designed to have all features of c++, plus removing all the limitation of c++. Java removes confusing features and poor standards of c++. It uses syntax which is quite clean and effective as there are no header files, pointers, structures, unions, virtual base classes and concept of operator overloading etc. However with Java you have to code a lot because it doesn't have drag-and-drop features as Visual Basic. But now-a-days there are third-parties which provides drag-and-drop features in Java Development Environment. Java helps programmer to develop a software which can run stand-alone in small machines.
    • Portable
    Java is portable programming language. Portability is one of the most loved feature of this programming language.Generally portability means that we can run same program or code on different machines, i.e. we write code once and result have no affects whether machine is of Windows, Mac, or Unix etc. C language lacks portability to a wide range. In C we have to recompile the code when using it with different operating systems. Java provides three types of portability : 1.source code portability, 2. CPU architecture portability and 3. OS/GUI portability.
    • Object Oriented
    Java is 99.9% object-oriented programming language. It is not purely object-oriented because of extensive use of primitive data types such as int, float, long etc, which are not objects. Object Oriented Programming language has all its main focus on data i.e. Objects. It also focuses on the interfaces that creates those objects. Every thing in java has been encapsulated into an Object. It provides many benefits such as code reusability, faster and flexible programs, less errors and isolation to programmers to work individually.
    • Interpreted
    Java is an Interpreted Programming Language. Interpreted languages provides advantages of platform independence. Generally Java program is first compiled into bytecode and this bytecode is been interpreted by the interpreter installed on different JVM's. So Java language being interpreted also provides advantage of dynamic typing i.e runtime execution rather than compile time execution.
    • Network Oriented
    Java is a Network-Savvy Programming Language. By this we mean that Java has an excellent library of routines which helps us coping with TCP/IP protocols like HTTP and FTP. By the help of Java's Network capabilities applications with the help of URL's can access and open objects across the network. This feature is as simple as accessing a local file over the ssystem. Networking tasks have become very much easy with the extensive use of Java , an example can be opening and closing of a socket connection and remote method invocation for establishing communication between the distributed objects.
    • High Performance
    Java is one of the most preferred language when it comes to performance. It is an interpreted language, so the bytecodes interpretation is of high performance.At runtime these bytecodes are easily translated to machine code by just-in-time compilers. They provide higher performance than the old compilers because they have additional information available to them that which code needs to be executed again-and-again, so they optimize only those parts of code.
    • Robust
    Java is a Robust Programming Language. Java was designed to write reliable programs. Its main aim was to become a language which can detect as many as possible errors early rather than at runtime. Java detects many such issues at compile time only as compared to many other programming language which have issues at runtime. Java is considered to be Robust because it overcomes problem of memory leakage and data corruption. Other languages like C that use pointers to access structures like arrays, strings, objects and VB which use no pointers, so it worries less about the memory allocation for above structures. While VB faces problem when accessing data structures as being the pointerless language. So Java was designed so as to work with data structures without any pointers. Thus problem of Bad pointers were avoided which caused data corruption and memory leakage.
    • Secure
    Java is one of the most highly secured programming language. The creation of Java was done keeping security on high priority. As Java is language designed to be used with networked/distributed environments much of the steps were taken to make it virus free. Few issues had come when this language was out in market. Issues by worms and viruses making the runtime stack overrun, corrupting memory space and reading of files for which they don't have permission even. As of now this issues have been fixed and now the classes written comes with digital signatures of the author so that you can give permission to run it own your machine by seeing the digital signature.
    • Dynamic
    Java is highly dynamic programming language. It is far ahead than other languages such as C or C++. Generally by Dynamic we mean that the language is designed in such a way that when suppose we want to extend or add, it does not create any problem for the environments. Many of Java libraries have added methods and instance variables which have no affect on the person using that library. This feature is really helpful when we want to add code in runtime such as gui builders and debuggers.
    • Multithreaded
    Java is highly Multithreaded Programming Language because it has to output better real-time behavior and response. Java's platform dependency weakens when coming to implement threads. As compared to other programming language Java makes it easier to use threads. Java is platform independent only in calling multithreaded code and generally loads all its multithreaded implementation on underlying operating system. Basically if we look at the ease to use threads then Java is powerful language and has an attraction for server side development.
    • Architecture
    Java is Architectural Neutral Programming Language. Generally compiler generates bytecode from the source code, this byte-code is considered to be architecturally neutral and it requires no additional CPU architecture to execute the byte-code , other than JVM. The byte-code is computer architecture independent and it needs only the interpreter which could translate it to native executable instructions. Click here to download complete ppt 
    © 2021 Learn Java by Examples Template by Hubberspot