MainMenu

Home Core 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


Stack and heap in Java?

Why is Java platform independent ?

What is Java ?

Access Specifier in java

Data Types in Java



Stack and heap in Java?



Where dows 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 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'.

OR

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 ?



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

27 comments:

  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|

    ReplyDelete
    Replies
    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

      Delete
  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

    ReplyDelete
  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

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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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 site.fire and safety courses in chennai

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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


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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete