Home Java Overview Maven Tutorials

Saturday, 14 January 2017

Core Java for selenium Introduction

Hello Friends this section will cover the core java tutorial which is enough to learn selenium automation tool.

For Video Tutorial : Move on Youtube Channel

Note : Select the playlist as per your need & move with number sequence

Video Tutorial for this article : CLICK HERE

History of Java?

Stack and heap in Java?

Why is Java platform independent ?

What is Java ?

Access Specifier in java

Data Types in Java

History of Java?

Java का पहला नाम 'Oak' इस पेड़ से रखा गया | ये रखने का मतलब 'James Gosling' और उनके सहकारी जहा पर Java के लिए काम करते थे, वहा पर 'Oak' का पेड़ था और 'Oak' ये कई देशों का राष्ट्रीय पेड़ भी है | इसी लिए 'Oak' ये नाम रखा गया |

ये 'Oak' नाम 1991 में रखा गया | लेकिन ये 'Oak' नाम पहले से ही 'Oak Technologies' का था |

उसके बाद 'Oak' का नाम बदलकर 'Java' रखा गया |

Java ये नाम रखने की एक ही वजह थी कि, जब 'James Gosling' और उनके सहकारी जब काम करते थे तब 'Java' नाम के बीज की Indonesian coffee पीते थे और 'Java' ये नाम काफी नया भी था | इसीलिए 'Java' नाम रखा गया |

अभी 2010 में Sun Microsystem ने 'Oracle' को ये बेच दी |

जब java का प्रारंभ हुआ तब उसका पहला नमूना '1995' में आया |

Introduction for Java/Core Java

Java ये दुनिया भर में बहुत ही प्रसिध्द programming Language है | Java के लिए तीन प्रकार बनाये गए है |
Java SE (Standard Edition)
Java EE (Enterprise Edition)
Java ME (Micro Edition)

1. Java SE
Java SE ये Basic Programming के लिए इस्तेमाल किया जाता है, इसे Core Java भी कहा जाता है |

2. Java EE
Java EE ये Advanced Programminng है , इसे Advanced Java भी कहते है |

3. Java ME
Java ME ये mobile programming के लिए उपयुक्त है, लेकिन इसका android से कोई सम्बन्ध नहीं है |

Stack and heap in Java?

Where does everything live ?

Before we create an object it makes sense to understand where things live and how long they live for.
Two areas of memory to care about : one where objects live(The Heap) and the one where methods invocations and local variables live(the stack).

What is JDK, JRE & JVM

The Java Development Kit (JDK) is one of three core technology packages used in Java programming, along with the JVM (Java Virtual Machine) and the JRE (Java Runtime Environment). It's important to differentiate between these three technologies, as well as understanding how they're connected:
The JVM is the Java platform component that executes programs.
The JRE is the on-disk part of Java that creates the JVM.
The JDK allows developers to create Java programs that can be executed and run by the JVM and JRE.
Developers new to Java often confuse the Java Development Kit and the Java Runtime Environment. The distinction is that the JDK is a package of tools for developing Java-based software, whereas the JRE is a package of tools for running Java code.

What happens when a JVM Starts Up?

1).When a JVM starts up, it gets a chunk of memory from the underlying OS and it uses it to run your java program.
2).How much memory dows it get? That depends on your version of the JVM(and on which platform).
3).Usually you won't have to care about how much menory it gets.
4).All objects are garbage-collectable on the heap.

Instance Variable

Instance varibales are declared inside a class but not inside a method. They represent each individual field that an object has.
Example :-
public class House
int table;

Local Variable

Local variables are declared inside a method, including method parameters. They are temporary, therefore they only live as long as the method is on the stack --in other words, as long as method has not reached the closing curly brace.
Example :-
public void g(int x)
int i = x+3;
boolean b = true;

Memory management can be better understand by below image :-

Why is Java platform independent ?

First understand the concept of other language c/c++ processing

prepocessor use to process the source file and the lines which start from #(like include studio etc) and now after preprocessing all the lines which starts from # will be replaces by some code. Now compiler will read this temporary file and will convert it in object file, and then linker will come into existence and it will link library files to object file and will create .exe file.

Remember : All the functions are coded with in library file and declaration is in header file.

Now in JAVA how the source file will be processed

The best feature of java is that it is platform independent. Platform independent means writing codes in one operating System "Windows XP" and executing that code on another platform 'Linux'.


WORA : Write Once and Run Anywhere

Bytecode : Bytecode is the machine language of the Java Virtual Machine by using bytecode execution java proves it's a platform Independent Language.

Source code : Actual java code

Java Compiler : Java Compiler convert the Source code to Byte code.

Java Virtual Machine (JVM) : JVM have Java Interpreter & JIT Compiler and JVM converts byte code .class to executable code object file(.obj file), this .obj file use to generate the Output.

Different types of JVM available on different operating System.

Using this JVM same .class file can run on various platforms.

What is meant by JIT Compiler ?
JIT Compiler is a compiler that converts program source code into native machine code just before running the program. It is Faster and more efficient to perform huge application.

What is java ?

C is procedure oriented language.
Java is object oriented Language.
Java was created by James Gosling from Sun Microsystems (Sun) in 1991.
The first publicly available version of Java (Java 1.0) was released in 1995.
Sun Microsystems was acquired by the Oracle Corporation in 2010.
In 2006 Sun started to make Java available under the GNU General Public License (GPL). Oracle continues this project called OpenJDK.
Java programming language was originally developed by Sun Microsystems which was initiated by James Gosling and released in 1995 as core component of Sun Microsystems' Java platform (Java 1.0 [J2SE]).

Sun Microsystems has renamed the new J2 versions as Java SE, Java EE and Java ME respectively. Java is guaranteed to be Write Once, Run Anywhere.

Java is:
Object Oriented: In Java, everything is an Object. Java can be easily extended since it is based on the Object model.
Platform independent: Unlike many other programming languages including C and C++, when Java is compiled, it is not compiled into platform specific machine, rather into platform independent byte code. This byte code is distributed over the web and interpreted by virtual Machine (JVM) on whichever platform it is being run.

Simple: Java is designed to be easy to learn. If you understand the basic concept of OOP Java would be easy to master.

Secure: With Java's secure feature it enables to develop virus-free, tamper-free systems. Authentication techniques are based on public-key encryption.

Architectural-neutral :Java compiler generates an architecture-neutral object file format which makes the compiled code to be executable on many processors, with the presence of Java runtime system.

Portable:Being architectural-neutral and having no implementation dependent aspects of the specification makes Java portable. Compiler in Java is written in ANSI C with a clean portability boundary which is a POSIX subset.

Robust:Java makes an effort to eliminate error prone situations by emphasizing mainly on compile time error checking and runtime checking.

Multithreaded: With Java's multithreaded feature it is possible to write programs that can do many tasks simultaneously. This design feature allows developers to construct smoothly running interactive applications.

Interpreted:Java byte code is translated on the fly to native machine instructions and is not stored anywhere. The development process is more rapid and analytical since the linking is an incremental and light weight process.

High Performance: With the use of Just-In-Time compilers, Java enables high performance.

Distributed:Java is designed for the distributed environment of the internet.

Dynamic: Java is considered to be more dynamic than C or C++ since it is designed to adapt to an evolving environment. Java programs can carry extensive amount of run-time information that can be used to verify and resolve accesses to objects on run-time.

Access specifier in Java

Public , Private & protected Keywords :

private - Only the current class will have access to the field or method.

protected - Only the current class and subclasses (and sometimes also same-package classes) of this class will have access to the field or method.

public - Any class can refer to the field or call the method.

PrivateNon modifierProtectedPublic
Same package sub classNoYesYesYes
Same package non sub classNoYesYesYes
Different package subclassNoNoYesYes
Different package non subclassNoNoNoYes

Why Java is platform independent language:

Javac – compiler that converts source code to byte code.

JVM- interpreter that converts byte code to machine language code.

As we know java is both compiler & interpreter based language. Once the java code also known as source code is compiled, it gets converted to native code known as BYTE CODE which is portable & can be easily executed on all operating systems. Byte code generated is basically represented in hexa decimal format.

After compilation, the interpreter reads the generated byte code & translates it according to the host machine. . Byte code is interpreted by Java Virtual Machine which is available with all the operating systems we install. so to port Java programs to a new platform all that is required is to port the interpreter and some of the library routines.

Source code -> javac ->Universal byte code

Universal byte ->jvm/java -> execute them on a particular machine.

Data Types in Java:

Based on the data type of a variable, the operating system allocates memory and decides what can be stored in the reserved memory.

There are two data types available in Java:

• Primitive Data Types

• Reference/Object Data Types

Primitive Data Types:

byte: • Byte data type is an 8-bit signed two's complement integer.
• Minimum value is -128 (-2^7)
• Maximum value is 127 (inclusive)(2^7 -1)
• Default value is 0

short: • Short data type is a 16-bit signed two's complement integer.
• Minimum value is -32,768 (-2^15)
• Maximum value is 32,767 (inclusive) (2^15 -1)

int: • Int data type is a 32-bit signed two's complement integer.
• Minimum value is - 2,147,483,648.(-2^31)
• Maximum value is 2,147,483,647(inclusive).(2^31 -1)

long: • Long data type is a 64-bit signed two's complement integer.
• Minimum value is -9,223,372,036,854,775,808.(-2^63)
• Maximum value is 9,223,372,036,854,775,807 (inclusive). (2^63 -1)

float: • Float data type is a single-precision 32-bit IEEE 754 floating point

double: • double data type is a double-precision 64-bit IEEE 754 floating point.

boolean: • boolean data type represents one bit of information.
• There are only two possible values: true and false.

char: • char data type is a single 16-bit Unicode character.

Reference Data Types:
• Reference variables are created using defined constructors of the classes. They are used to access objects. These variables are declared to be of a specific type that cannot be changed.
Tags :

Core java introduction, overview of core java, access specifier in core java, data types in core java


  1. I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details.

    selenium training in chennai|
    selenium training in bangalore|

    1. Core Java is the basic knowledge and pre-requisites to learn Selenium. Thank you for your guidance. keep Share more useful post.

      Best DevOps Training in Chennai
      Best DevOps Course in Chennai

  2. I‘d mention that most of us visitors are endowed to exist in a fabulous place with very many wonderful individuals with very helpful things.

    hadoop training in bangalore

  3. Great site for the post and I am seeing the most of contents have useful for my Career. Thanks to such a useful information.
    Java Training in Chennai
    Java Course in Chennai

  4. I accept there are numerous more pleasurable open doors ahead for people that took a gander at your site.
    Java Training in Marathahalli

  5. I have to voice my passion for your kindness giving support to those people that should have guidance on this important matter.
    hadoop training in bangalore

  6. Thanks for one marvelous posting! I enjoyed reading it; you are a great author. I will make sure to bookmark your blog and may come back someday. I want to encourage that you continue your great posts, have a nice weekend!

    Devops Training in Chennai

  7. I wish to indicate because of you only to bail me out of this specific trouble.As a consequence of checking through the net and meeting systems that were not beneficial, I thought my life was finished.
    nebosh igc certificate course in chennai

  8. I have to voice my passion for your kindness giving support to those
    Thanks for one marvelous posting! I enjoyed reading it; you are a great
    author. And i suggest for Java Training in chennai Visit Here: Best Java Training Institute in Chennai

  9. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this and safety courses in chennai

  10. Thank you a lot for providing individuals with a very spectacular possibility to read critical reviews from this site.
    python course in pune
    python course in chennai
    python course in Bangalore

  11. I am so proud of you and your efforts and work make me realize that anything can be done with patience and sincerity. Well I am here to say that your work has inspired me without a doubt.

    Best Devops Training in pune
    excel advanced excel training in bangalore

  12. Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.
    AWS Training in Bangalore |Best AWS Training Institute in Bangalore BTM, Marathahalli
    AWS Training in Chennai | AWS Training Institute in Chennai Velachery, Tambaram, OMR

  13. I was recommended this web site by means of my cousin. I am now not certain whether this post is written through him as nobody else recognise such precise about my difficulty. You're amazing! Thank you!

    angularjs-Training in velachery

    angularjs-Training in pune

    angularjs Training in bangalore

    angularjs Training in bangalore

    angularjs Training in btm

    angularjs Training in electronic-city

  14. This is a nice article here with some useful tips for those who are not used-to comment that frequently. Thanks for this helpful information I agree with all points you have given to us. I will follow all of them.

    rpa training in bangalore
    best rpa training in bangalore
    rpa training in pune

  15. Great Article… I love to read your articles because your writing style is too good,
    its is very very helpful for all of us and I never get bored while reading your article because,
    they are becomes a more and more interesting from the starting lines until the end.
    Java training in Bangalore

  16. It would have been the happiest moment for you,I mean if we have been waiting for something to happen and when it happens we forgot all hardwork and wait for getting that happened.

    Selenium training in Chennai
    Selenium training in Bangalore
    Selenium training in Pune
    Selenium Online training
    Selenium training in bangalore

  17. Thanks for sharing this blog post. it gives more useful information about java.
    java classes in bangalore

  18. Thank you for that valuable post. Fresher’s have struggle to learn java in this post guide that students and give more extended knowledge of Java.
    Core Java Training In Bangalore

  19. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
    microsoft azure training in bangalore
    rpa training in bangalore
    best rpa training in bangalore
    rpa online training

  20. Thanks to proceeding wonderful guidance about core java. Also, I have realized how this is supportive of selenium development.

    Core java Training in Bangalore

  21. Hi Admin,

    I had already bookmarked this blog while writing this. Good Blog with very interesting way of explaining things. Thanks for sharing with us. Really appreciated.

    Salesforce Training in Bangalore | Salesforce Course in Bangalore | Salesforce Developer Training in Bangalore | Salesforce Developer Course in Bangalore

  22. Hadoop is a tool utilized broadly in big data analysis, encouraged with the system of PCs sorted out to tackle issues including an enormous measure of information and calculation. Get Hadoop Training in Bangalore with certification by the assistance of specialists and get complete knowledge over the technology.

    Hadoop Training in Bangalore | Hadoop Course in Bangalore

  23. I’m experiencing some small security issues with my latest blog, and I’d like to find something safer. Do you have any suggestions?
    safety course in chennai
    nebosh course in chennai

  24. Thank you! It was a great help. What I most loved about it was how you presented the information. Brilliant and helpful.Universal Informatics provides the best JAVA TRAINING IN INDORE

  25. Have you been thinking about the power sources and the tiles whom use blocks I wanted to thank you for this great read!! I definitely enjoyed every little bit of it and I have you bookmarked to check out the new stuff you post
    Java training in chennai

  26. I always enjoy reading quality articles by an individual who is obviously knowledgeable on their chosen subject. Ill be watching this post with much interest. Keep up the great work, I will be back
    Advanced Java certification training
    Salesforce certification training

  27. Hey Nice Blog!! Thanks For Sharing!!! Wonderful blog & good post. It is really very helpful to me, waiting for a more new post. Keep Blogging!Here is the best angularjs online training with free Bundle videos .

    contact No :- 9885022027.
    SVR Technologies

  28. Your articles really impressed for me,because of all information so nice.devops Training in Bangalore

  29. These provided information was really so nice,thanks for giving that post and the more skills to develop after refer that post.Amazon web services Training in Bangalore

  30. I gathered a lot of information through this article.Every example is easy to undestandable and explaining the logic easily.python training in bangalore

  31. Very useful and information content has been shared out here, Thanks for sharing it.selenium training in bangalore

  32. This is really an awesome post, thanks for it. Keep adding more information to this.mulesoft training in bangalore

  33. Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.
    data science course

    data science interview questions

  34. Your articles really impressed for me,because of all information so nice
    AngularJS Training in Pune | RPA Training in Pune | Devops Training in Pune

  35. Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites! Thanks for sharing. Great websites!
    business analytics course

    data analytics courses

    data science interview questions

    data science course in mumbai


  36. Whatever we gathered information from the blogs, we should implement that in practically then only we can understand that exact thing clearly, but it’s no need to do it, because you have explained the concepts very well. It was crystal clear.i also want to inform you the best salesforce cpq training videos . thankyou . keep sharing..

  37. Nice blog,I understood the topic very clearly,And want to study more like this.
    Data Scientist Course

  38. I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.

    machine learning course

    artificial intelligence course in mumbai

  39. This is a wonderful article, Given so much info in it, Thanks for sharing. CodeGnan offers courses in new technologies and makes sure students understand the flow of work from each and every perspective in a Real-Time environmen python training in vijayawada. , data scince training in vijayawada . , java training in vijayawada. ,

  40. Impressive! I finally found great post here. Nice article on data science . It's really a nice experience to read your post. Thanks for sharing your innovative ideas to our vision.
    Data Science Course
    Data Science Course in Marathahalli
    Data Science Course Training in Bangalore

  41. Mmm.. good to be here in your article or post, whatever, I think I should also work hard for my own website like I see some good and updated working in your site. data analytics course in surat

  42. Thanks for sharing this valuable information, we also provide instagram video download and,
    really appreciate your hard work and good research that help us in for of your good valuable article. Keep updating us with your awesome content.