2015-11-30

Java (another word for “coffee”) is also a programming language which is the base for nearly every kind of networked app. Want the perfect Java recipe book? Eager to know what’s brewing and which are the latest trends in this programming language? Learn more about Java, a programming language designed initially for entertainment appliances right here.



#1: Java was born from a language named Oak.

Oak was originally a platform independent language developed for video game consoles, VCRs and other recording appliances to communicate.

Meanwhile, the World Wide Web’s reach was expanding and Oak’s developers, James Gosling and his team, shifted their focus to the Internet.

Oak became Java and WebRunner, an Oak enabled browser changed into another avatar- the HotJava web browser.

Java was invented in 1992 after Oak, named for the tree outside Gosling’s window underwent a transformation.

Legend has it that Java was named at a cafe the development team used to visit and magic number “0xCafeBabe” in the class files is the specific name of the coffee house.



Java was developed at Sun Labs where the team started a “clean up” of C++ and ended up with a whole new language and runtime.

#2: There are a host of Java sites for aspiring developers.

Sun’s main technology site is java.sun.com. Collaborative site run by Sun is known as java.net.  An advocacy or news site run by Sun is java.com/. For Java related news, log on to www.javaworld.com.

#3: Java is a programming language with unique features.

Java forms the foundation for developing and delivery of embedded and mobile applications and games as well as Web content and enterprise software. Java has close to 9 million developers worldwide. From laptops and PCs to gaming consoles and supercomputers, the aroma of Java permeates just about everywhere. Java is all of the below:

#4: Java Basic Syntax involves 4 components- object, class, methods and instant variables.

Method comprises the header and the method body. All parts of a method are as follows: modifiers, return type.

Exception handling is a key feature of Java in that the method catches an exception using a blend of try and catch keywords. Try/catch block is placed around the code, making it a protected code that generates an exception.

#5: Java programming language is case sensitive.

All Java components- class, variables and methods- are referred to as identifiers.

As Java is a case sensitive language, identifiers would differ depending on whether upper or lower case is used. For example, “hello” would differ in meaning from “Hello.” Identifiers should begin with a letter (A or a), currency character($) or underscore (__). It should be remembered that keywords cannot be used as identifiers.

Examples

Legal identifiers i.e those that work- _value, $salary

Illegal identifiers i.e those that malfunction- KLM123, #AB2

After the first character, identifiers can have any character combination.

Class Names: First letter should be in upper case for every class name. If a class has several words in its name, each inner words first letter must be in upper case.

Method Names: These should start with lower case letters. Where there are several names to form the method, each inner word must be in upper case.

File Name: Names of program files should match class name, otherwise program will not compile.

For example, if the class name is “MyJavaProgram”, the file should be saved as “MyJavaProgram.java.”

There are 2 categories of modifiers namely access and non-access.

Examples

Access Modifiers: default, public, private

Non Access Modifiers: final, abstract

4 access levels are there:

Visible to package- the default. Modifiers are not needed.

Visible to class alone (private)

Visible to everyone (public)

Visible to package plus sub classes (protected)

3 kinds of variables in Java are as follows:

Local variables

Class/static variables

Instance/Non static variables

Java Arrays: These are objects that store many variables of the same time though an Array is an object on the heap itself.

Example of Java Enum syntax:

public enum Level {High, Medium, Low}

Enums can be on their own or within a class. Methods, constructors and variables can also be defined within enums.

In Java, keywords are reserved words- these cannot be used as constant or variable or any other identifier names.

Types of Comments in Java

Java supports multiple as well as single line comments in a manner similar to C and C++. Java compiler ignores characters inside the comment.

#6: Java has different types of built in data including strings, numbers, integers and booleans.

2 data types are there in Java namely Primitive Data Types and Reference/Object Data Types.

8 primitive data types are supported by Java predefined by language and named via keyword. These are:

byte

int

float

long

short

double

char

boolean

Reference Data Types

These are variables created using defined constructors within the classes and are employed for accessing objects. These are variables which cannot be changed because they are of a certain type. For example, Employer, Employee etc.

Class objects and various array variables also come under reference data type.

Null is the default value of a reference variable. Reference variable refers to object of the declared type or new compatible type.

Literal is a source code representation belonging to a fixed value represented directly in the code in the absence of computation. Literals can be assigned to primitive type variables. String literals in Java are specified by enclosing sequence of characters between a pair of double quotes. Example of string literal is “Hello There.” Java language supports special escape sequences for string and char literals as well.

Types of Operators

Arithmetic Operators: There are following arithmetic operators in Java: addition, subtraction, multiplication, division, modulus, increment, decrement.

Relational Operators

Bitwise Operators

The Bitwise Operators

Logical Operators

Conditional/Ternary Operators- Consist of three operands and are used for evaluation of boolean expressions.

This operator is written in the following way:

variable x=(expression)?value if true: value if false

instanceOf Operator – This one comprises description of whether object is of particular type (class or interface). This operator is written as:

(Object reference variable) instanceOf (class/interface type)

Loop Troop: while, do…while, for, enhanced for

Keyword Types: break, continue

While the break keyword is for stopping an entire loop and must be used within the loop or switch statement, continue keyword is used in loop control structures using the loop to jump to its next iteration.

Types of statements: if, if…else,  is…else if…else, nested if…else, switch.

#7: Java is all about learning the core before moving on to advanced level.

Understanding what core Java is about is a must before mastering this programming language. So what are the core concepts? Well, they are as follows:

Object oriented programming concepts ( this includes abstraction, containment, inheritance, encapsulation and polymorphism).

Reasons why Java is a platform independent language which can be run on all OS like Mac, Windows and Unix

Manner and nature of Java Virtual Machine

Understanding the Java collection framework

In depth knowledge of data types and few java lang classes like String, System, Math etc

Coding competitions

Mastering Java is all about putting theory into practice. Simple coding exercises are good to begin with, but if you have to get the perfectly brewed recipe, you need to try out different types of logic exercises ( for example finding prime numbers between 1 to 2000, creating a Fibonacci series, computing number factorials and more) and file input/output exercises such as listing files, reading and displaying files on console, creating file with content).  You should also try string manipulation exercises such as parsing numbers from strings, replacing part of the string and building number pyramids or creating 2 player text based games.

Next in line are the servlets and JSP which are good standard APIs. JSF or JavaServer Faces is a web framework helping in user interface simplification for Java web applications. Building web based applications are next and these can be presentation or service based. It takes very little time for programming skills to go obsolete. This is why Java programmers should try to keep in touch with the current trends to gain an edge over others. Mastering theory will not help you. Applying it will.

#8 Software developers all over the world use Java.

Java has been refined further, tested considerably and extended as well as proven by a whole range of software developers and architects. This programming language is designed to ensure development of high performance apps for numerous computing platforms. Java can boost productivity, communication and partnership besides reducing enterprise and consumer applications.

So, why does Java score over the others?

You can write software and run it on any platform.

Users can create programs running within a web browser and accessing available web services apart from developing server side applications for online polls, commerce firms. HTML forms processing and much more.

Customized apps can be created using Java and you can write efficient applications for every type of electronic device including wireless modules and mobile phones.

Numerous colleges and universities offer Java programming courses. Notable among them is the Oracle Academy which provides support, training and certification to K12 vocational and higher educational institutions for teaching purposes.

Developers can further sharpen their skills and learn how to come up with the perfect cuppa by reading the Java web developer site developed by Oracle and also subscribing to Java technology focused newsletters and magazines using the Java tutorial or signing up for virtual, taught or web courses and/or certifications. There are also many visual education tools such as BlueJ and Alice to impart training in this programming language to developers.

#9: Java has significant language features which offer benefits to users.

Platform independence means compilers do not have to produce native object code for platforms, and instead come up with byte code instructions for Java Virtual Machine. Java is an object oriented language with a rich standard library and language support for progressive language features such as strings, threads, arrays and exception handling.

Java is easy to master and there are numerous classes and methods in six key functional areas which have to be learnt.

Input/output classes are there to read and write data from numerous sources and networking permits communication across computers online or through a LAN.

Platform independent GUI applications can be created through Java’s Abstract Window Toolkit.

Java Applet is a special class that lets you come up with downloadable Java programs that can be run on client browsers.

Applet is also perfect for stand along apps and creation of programs that can be downloaded on the web page and run on browsers.

Java is very much like its popular kin C++ as far as syntax is concerned. This has made it very easy to use.

Moreover, this programming language does not require free dynamically allocated memory, creating less memory errors and making the programs simpler to write.

#10 Java can be used anywhere and everywhere.

Education, embedded systems, application programming and simulation are some of the many areas where Java can be applied. Areas of application include network apps, WWW Applets, Cross platform app development and more. Java is a programming language as well as a virtual machine and API specification.  One of the biggest advantages of this language making it easy for use across numerous settings is its high level of security and safety. Interpreters apply numerous tests to the compiled code for checking for illegal codes and this has the following advantages:

Compiled code causes no operand stack over or underflows

It performs legal data conversions and only legal object field access

All upcode parameter types undergo checking so that they are legal

Another property of Java which lends itself to multiple platforms is the top performance. Java environment compiles the byte code into native machine code at runtime.

Conclusion

Java is a lot more than just a usual programming language. It is a multi-platform unique programming language with inbuilt security to prevent hacking. From the safety point of view as well as convenience, Java clearly scores over other programming languages. So, if you need a pick-me-up in the virtual world, Java is the programming language which will leave your cup more full than empty in every which way!

The post 10 Things About Java You Must Know appeared first on eduCBA.

Show more