Wednesday, 28 March 2018

10 Things You Didn't Know About Java


                                             java training in chennai
Many of you might have been working with Java since its beginning. And, for many of you, you might just have started working with Java. In this post, we will discuss some of the facts about Java that are useful for both freshers as well as those with more experience.

JAVA IS EVERYWHERE
Java is one of the most dominant programming languages out there. Millions of developers and a huge number of devices worldwide are using the Java programming language; from laptops to data centers, gaming consoles to scientific supercomputers, cell phones to Internet. The reason is its simplicity and readability. Almost all native Android apps are built in Java and 90 percent of Fortune 500 companies use Java as a server-side language for backend development. 
INITIALLY JAVA WAS CALLED OAK
James Gosling was a developer for Sun Microsystems that was working to build a new programming language for their set-top box project in the 1990s. He originally created Oak, a language he named after the oak tree standing outside his office, which later evolved and was renamed Java.
MINECRAFT WAS ORIGINALLY WRITTEN IN JAVA
Minecraft, the explosively popular 3D sandbox video game, is written completely using Java code. The game’s creator, Notch, chose to write Minecraft in Java because it was the programming language he was most comfortable writing. Now owned by Microsoft, there is now a version of Minecraft built using C++.
IT’S A GREAT CODING LANGUAGE TO LEARN
It’s one of the most popular choices as a first coding language to learn. Although it can be tough due to its complicated syntax, Java is often chosen as a first language because it teaches you more than just coding; it teaches you to think like a programmer. Students of Java will also learn foundational coding concepts that will be helpful as they move on to other languages. You can learn Java by joining any Java Course.
DYNAMIC JAVA
There is something called Java Instrumentation and Java ReflectionsInstrumentation allows you to change the already compiled classes. This is useful if you want to change the code at run time. There are open source libraries (likeAspectJ, ASM, Javassist, cglib, etc.) that allow Java instrumentation. Using reflection, you can access even private variables of a class. Similarly, Class.forName()loads a class at run time. This is very useful method that Java provides.
JAVA MEMORY
·         Heap: All instance variables, objects, arrays.
·         Stack: All local variables, methods only.
·         Heap: When Java program starts, it gets some memory from OS. Default size is 128 MB. It can be set by –Xms and –Xmx (for example -Xmx1G).
·         Out of memory: when JVM starts processing, initially it gets some memory (and heap) gets allocated. As processing goes on, more and more memory gets occupied. When a situation comes that there is no more space left, then an out of memory error might be thrown.
4 PLATFORMS OF JAVA
·         Java Standard Edition: contains all core libraries and functionalities
·         Java Enterprise Edition: contains frameworks and libraries to build applications that are used mostly in enterprises
·         Java Micro Edition: contains frameworks and libraries to build applications that run on micro devices, like mobiles and tablets
·         Java FX: contains graphic libraries to build rich client applications that operate consistently across diverse platforms
LESS USED BUT SHOULD KNOW KEYWORDS:
·         Native methods: In this method is implemented in platform dependent way, often in C.
·         strictfp methods: class or method can be strictfp. It means floating point operations are strict.
·         Transient: means skip this while serialization.
·         Volatile: it tells JVM that the thread accessing this variable must always sync its local private copy with master copy.
JAVA IS USED IN MANY PLACES
Java is used in more places than you might think. Google Web Toolkit compiles Java to optimized JavaScript for all main browsers, making Java a first-class language for browser-side development. Java is the main language of development for Android, and new products allow translation or compilation of Java for IOS. Java is a safe choice no matter what you are developing for.
Wrongly overloaded hashCode() of your business object can make your Collections (HashMap) fail.
This can happen if you override hashCode as below:
   Return a transient type variable as hashCode.
   Return time as hashCode.


JAVA INTERVIEW QUESTIONS AND ANSWERS

Are Looking for Java Training? Learn Advanced Java Besant advances – Only Institute with Oracle Authorized Java Training Center...