Java, General-purpose Programming Language

-- Leave a Comment
Java is a general purpose programming Language. James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991. This was initially called "Oak", which was renamed as "Java" in 1995. The development motive of java was to make a platform independent language that can create create softwares that can be embedded in various consumer electronic devices.

General Purpose Programming Language

A general-purpose language is a computer language that is broadly applicable across application domains, and lacks specialized features for a particular domain. This is in contrast to a domain-specific language (DSL), which is specialized to a particular application domain.

Features of java

  • Simple
  • Object-Oriented
  • Robust
  • Multihreaded
  • Architecture-Neutral
  • interpreted and High Performance
  • Distributed
  • Dynamic
  • Secure
  • Portable
A Simple java Program:

class JavaFirst
    public static void main(String args[])
        System.out.println("Hello World!");

Java Keywords

abstract final public
assert finally return
boolean float short
break for static
byte goto strictfp
case if super
catch implements switch
char import synchronized
class instanceof this
const int throw
continue interface throws
default long transient
do native true
double new try
else null void
enum package volitile
extends private while
false protected

Enhanced For Loop in Java

Enhanced loop was introduced on java 5. It is used to loop through the Arrays.
class LoopTest
    public static void main(String args[])
         int numbers[]={10,11,12,13,14};
         for (int i : numbers)
The Output of the Loop will be:

Array Declaration in Java

int [] a, b, c;
will create 3 arrays a, b and c
int a[], b ,c[];
will create 2 arrays a and c, where as a int variable b.

If we use the [] in front it will create all the variables as array.


In java String are not simply an array of characters. String is defined as objects. String are used to declare String variables. String objects have many special features and attributes that make them powerful.

The Bitwise Operators

Java defines several bit-wise operators which  can be applied to the integers, long, short, char and byte. Bit-wise operator works on bits and perform bit by bit operations.
Where a = 60 and b = 13
a = 0011 1100
b = 0000 1101
(Binary AND) a&b = 0000 1100
(Binary OR) a|b = 0011 110.1
(Binary XOR) a^b = 0011 0001
(Binary NOT) ~a = 1100 0011

Argument Passing

Call by Value and Call by Reference
When a primitive type is passed to a method, it is done by use of call-by-value. Object are implicitly passed by use of call-by-reference. 

Hello This is Sagar Devkota. Studying Bachelor of Software Engineering at Pokhara University. I know something about Linux, Android, Java, Nodejs, Unity3D and 3 dots :)


Post a Comment