• Save
Java
Upcoming SlideShare
Loading in...5
×
 

Java

on

  • 276 views

 

Statistics

Views

Total Views
276
Views on SlideShare
212
Embed Views
64

Actions

Likes
1
Downloads
3
Comments
0

2 Embeds 64

http://www.edureka.co 43
http://www.edureka.in 21

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Java Java Presentation Transcript

  • Java Review
  • Course Curriculum  Module 1 » Java Basics  Module 2 » Java Constructs  Module 3 » OOP Concept  Module 4 » Interfaces and Enums  Module 5 » Dynamic Data Storage  Module 6 » Threads  Module 7 » Exception Handling  Module 8 » Database & JDBC and Project
  • What is Java ? • Java - Java is not just a programming language but it is a complete platform for object oriented programming. • JRE - Java standard class libraries which provide Application Programming Interface and JVM together form JRE (Java Runtime Environment). • JDK - JDK (Java development kit) provides all the needed support for software development in Java. View slide
  • Java Virtual Machine (JVM) • Runs the Byte Code. • Makes Java platform independent. • Handles Memory Management. View slide
  • Byte Code • Java bytecode is the form of instructions that the Java Virtual Machine executes • A Java programmer does not need to be aware of or understand Java bytecode at all. • The model of computation of Java bytecode is that of a stack oriented programming language.
  • Garbage Collection • The programmer is not responsible for memory management in Java. • The memory area in JVM where objects are created is called Heap. • The memory is freed during runtime by a special thread called Garbage Collector. • The GC looks for objects which are no longer needed by the program and destroys them.
  • Garbage Collection
  • Garbage Collection
  • Garbage Collection
  • Garbage Collection
  • How Java works ? • Java compilers convert your code from human readable to something called “bytecode” in the Java world. • “Bytecode” is interpreted by a JVM, which operates much like a physical CPU to actually execute the compiled code. • Just-in-time (JIT) compiler is a program that turns Java bytecode into instructions that can be sent directly to the processor.
  • How Java works ?
  • Basic Java Syntax
  • Data Types in Java • Data types define the nature of a value • We need different data-types to handle real-world information Name Size (in bits) Range long 64 -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 int 32 –2,147,483,648 to 2,147,483,647 Short 16 –32,768 to 32,767 byte 8 –128 to 127 double 64 4.9e–324 to 1.8e+308 float 32 1.4e–045 to 3.4e+038 char 16 0 to 65,536 boolean ?? true/false
  • Primitive Types and Variables • boolean, char, byte, short, int, long, float, double etc. • These basic (or primitive) types are the only types that are not objects (due to performance issues). • This means that you don’t use the new operator to create a primitive variable.
  • Naming Convention of Variables • Can start with a letter, an underscore(_), or a dollar sign ($) • Cannot start with a number.  long _LongNumber = 9999999;  String firstName = “John”;  float $Val = 2.3f;  int i, index = 2;  double gamma = 1.2;  boolean value2 = false;
  • Statements & Blocks • A simple statement is a command terminated by a semi-colon: name = “Fred”; • A block is a compound statement enclosed in curly brackets: { name1 = “Fred”; name2 = “Bill”; } • Blocks may contain other blocks.
  • Flow of Control • Java executes one statement after the other in the order they are written. • Many Java statements are flow control statements: Alternation: if, if else, switch
  • Java Basic Constructs • If • If…else • Nested If…else • Switch Statement
  • If else– Syntax if ( <condition> ) { // Execute these statements if <condition> is TRUE }
  • If else– Syntax if ( <condition> ) { // Execute these statements if <condition> is TRUE } else { // Execute these statements if < condition> is FALSE }
  • If else– Syntax if ( <condition1> ) { // Execute these statements if <condition1> is TRUE } else if ( <condition2> ) { // Execute these statements if <condition2> is TRUE } else { // if both <condition1> and <condition2> is FALSE }
  • switch– Syntax switch (expression) { case cond1: block_1; break; case cond2: block_2; break; ... default: block_default; }
  • Operators • Provide a way to perform different operations on variables • Categories of Java Operators Assignment Operators = Arithmetic Operators - + * / % Relational Operators > < >= <= == != Logical Operators && || & | ^ Unary Operators + - ++ -- !
  • Assignment and Arithmetic Operators • Used to assign a value to a variable • Syntax – <variable> = <expression> • Java provides eight Arithmetic operators: – for addition, subtraction, multiplication, division, modulo (or remainder), increment (or add 1), decrement (or subtract 1), and negation. Assignment Operator =
  • Relational Operators • Used to compare two values. • Binary operators, and their operands are numeric expressions. Relational Operators > < >= <= == !=
  • Logical Operators • Return a true or false value based on the state of the variables • There are six logical operators Conditional AND Conditional OR AND OR NOT Exclusive OR Logical Operators && || & | ! ^
  • Static versus Non-static Variables • Static variables are shared across all the objects of a class – There is only one copy • Non-Static variables are not shared – There is a separate copy for each individual live object. • Static variables cannot be declared within a method.
  • •Q& A..?
  • Thanks..!