SlideShare a Scribd company logo
1 of 24
Download to read offline
JAVA
TajendarArora
OBJECTIVES
 What is Java?
 Why Java?
 Java System overview and Types of programs in java
 JVM
 JDK
 Primitive Data types in java
 Expressions in java
 Control Statements
 Naming conventions
 Arrays
 For-each loop
 Type casting
 Build first basic java program
 Command Line Arguments
TajendarArora
JAVA
 Java is high level programming language
introduced by Sun Microsystems in June 1995.
 Java is an object oriented language built upon C
& C++, It derived its object oriented features
from C++.
 The Java language has undergone several
changes since JDK 1.0 (1996) and now JSE 7 is
latest.
*jdk- Java Development Kit
*JSE- Java Standard Ediiton
TajendarArora
WHY JAVA
 Object-oriented
 Platform independent
 Built-in support for multi-threading, socket
communication and memory management
 Supports Web based applications (Applet,
Servlets and JSP)
 Vast library of predefined objects and operations
 Secure
TajendarArora
Tajendar Arora
JAVA FEATURES
 Simple and object oriented
 Look and feel of C
 Simplified object modeling
 Portability
 Java compiler generates byte codes
 Runtime systems for various platforms
 Size and behavior of basic data types defined
 Write once, run/debug anywhere
Tajendar Arora
JAVA FEATURES CONT.
 Availability
 Windows, Linux, Solaris,…
 Embedded systems
 Compiler and runtime are free
 Free IDEs: Eclipse, Netbeans
 Library
 Rich class library
 Part of the definition
 Standard GUI toolkit
Tajendar Arora
JAVA FEATURES CONT.
 Built-in model for concurrency
 Threads at the language level
 Synchronization
 Safety
 No Pointer!
 Automatic memory management – GC
 Networking
 Web Enabled
Tajendar Arora
JAVA SYSTEM OVERVIEW
APPLETS , SERVLETS AND APPLICATION
 An applet is designed to be embedded in a Web
page, and run by a browser.
 A servlet is designed to be run by a web server
which act as controller for we application.
 An application is a conventional standalone
program.
TajendarArora
Tajendar Arora
WHAT IS A VIRTUAL MACHINE?
 A virtual machine (VM) is an abstract computer
architecture
 Software on top of a real hardware
 Can run the same application on different
machines where the VM is available
Tajendar Arora
JVM CONT.
 Runtime environment for Java
 Implementation NOT defined
 Runs Java .class files
 Has to conform to Sun‘s specification
JDK DIRECTORY STRUCTURE
(JAVA INSTALLATIONS)
Assuming the JDK software is installed at /jdk1.7.0, here are
some of the most important directories:
/jdk1.7.0Root directory of the JDK software installation.
Contains copyright, license, and README files.
./jdk1.7.0/binExecutables for all the development tools
contained in the JDK. The PATH environment variable
should contain an entry for this directory.
/jdk1.7.0/lib Files used by the development tools.
Includes tools.jar, which contains non-core classes for support
of the tools and utilities in the JDK.
/jdk1.7.0/jre Root directory of the Java runtime environment
used by the JDK development tools. The runtime environment
is an implementation of the Java platform.
TajendarArora
PRIMITIVE DATA TYPES
 Main data types are int, double, boolean,
char
 Also have byte, short, long, float
 boolean has values true and false
 Variable Declarations look like,
 double x, y;
 int count = 0;
TajendarArora
EXPRESSIONS
 Assignment statements mostly look like those in
C; you can use =, +=, *= etc.
 Arithmetic uses the familiar + - * / %
 Java also has ++ and --
 Java has boolean operators && || !
 Java has comparisons < <= == != >= >
 Java does not have pointers or pointer arithmetic
TajendarArora
CONTROL STATEMENTS
•if (x < y) smaller = x;
•if (x < y){ smaller=x;sum += x;}
else { smaller = y; sum += y; }
•while (x < y) { y = y - x; }
•do { y = y - x; } while (x < y)
•for (int i = 0; i < max; i++) sum += i;
BUT: conditions must be boolean
TajendarArora
NAMING CONVENTIONS
Java is case-sensitive; maxval, maxVal, and
MaxVal are three different names Class names
begin with a capital letter All other names begin
with a lowercase letter Subsequent words are
capitalized: theBigOne Underscores are not used
in names,
These are very strong conventions.
TajendarArora
ARRAYS IN JAVA
 Java provides a data structure, the array, which
stores a fixed-size sequential collection of elements of
the same type. An array is used to store a collection of
data.
 Declare array
 dataType[] arrayRefVar; // preferred way.
 Creating Arrays:
 You can create an array by using the new operator
with the following syntax:
 arrayRefVar = new dataType[arraySize]; The above
statement does two things:
 It creates an array using new dataType[arraySize];
 It assigns the reference of the newly created array to
the variable arrayRefVar.
TajendarArora
FOR EACH LOOP FOR ARRAYS IN JAVA
 Since JDK 1.5 introduced a new for loop known
as foreach loop or enhanced for loop, which
enables you to traverse the complete array
sequentially without using an index variable.
 Example:
 The following code displays all the elements in
the array myList:
 public class TestArray {
 public static void main(String[] args) {
 double[] myList = {1.9, 2.9, 3.4, 3.5};
 // Print all the array elements
 for (double element: myList)
 { System.out.println(element);
 } } }
TajendarArora
TYPE CASTING IN JAVA
 Assigning a value of one type to a variable of
another type is known as Type Casting.
 In Java, type casting is classified into two types,
 Widening Casting(Implicit)
 Narrowing Casting(Explicitly done)

TajendarArora
TYPE CASTING IN JAVA
 Widening or Automatic type converion
 Automatic Type casting take place when,the two
types are compatible
 the target type is larger than the source type
 Example :
 int i = 100;
 long l = i;
 Narrowing or Explicit type conversion
 When you are assigning a larger type value to a
variable of smaller type, then you need to perform
explicit type casting.
 double d = 100.04;
 long l = (long)d;
 //explicit type casting required int i = (int)l;
TajendarArora
BUILDING STANDALONE JAVA PROGRAMS
 We can use different IDEs as well
 IDEs are more complex and have visual Java
development tools, tight integration with the
compiler or application server, and may include
tools for debugging, refactoring, version control,
and so forth. Some examples below
 Eclipse
 NetBeans
 BjueJ
 Jbuilder
TajendarArora
BUILDING STANDALONE JAVA PROGRAMS
 Prepare the file First.java using an editor
 /*
 This is a simple Java program.*/
 class First
 {
 public static void main(String args[])
 {
 System.out.println("This is a simple Java program.");
 }
 }
 Invoke the compiler: javac First.java
 This creates First.class
 Run the java interpreter: java First
 println is a member function for the System.out class
 String is built in class
* File name should be First.java
TajendarArora
COMMAND LINE ARGUMENTS
 A command-line argument is the information
that directly follows the program’s name on the
command line when it is executed. To access the
command-line arguments inside a Java program
is quite easy—they are stored as strings in the
String array passed to main( ).
 class CommandLine {
 public static void main(String args[]) {
 for(int i=0; i<args.length; i++)
 System.out.println("args[" + i + "]: " +args[i]);
 }
 }
 * length returns the length of array
TajendarArora
Thank you
TajendarArora

More Related Content

What's hot

Java 101 intro to programming with java
Java 101  intro to programming with javaJava 101  intro to programming with java
Java 101 intro to programming with javaHawkman Academy
 
Fundamentals of oop lecture 2
Fundamentals of oop lecture 2Fundamentals of oop lecture 2
Fundamentals of oop lecture 2miiro30
 
Hibernate introduction
Hibernate introductionHibernate introduction
Hibernate introductionSagar Verma
 
Fundamentals of JAVA
Fundamentals of JAVAFundamentals of JAVA
Fundamentals of JAVAKUNAL GADHIA
 
Core java lessons
Core java lessonsCore java lessons
Core java lessonsvivek shah
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language Hitesh-Java
 
Basics of java programming language
Basics of java programming languageBasics of java programming language
Basics of java programming languagemasud33bd
 
Java basic-tutorial for beginners
Java basic-tutorial for beginners Java basic-tutorial for beginners
Java basic-tutorial for beginners Muzammil Ali
 
Java 102 intro to object-oriented programming in java
Java 102   intro to object-oriented programming in javaJava 102   intro to object-oriented programming in java
Java 102 intro to object-oriented programming in javaagorolabs
 

What's hot (20)

Java 101 intro to programming with java
Java 101  intro to programming with javaJava 101  intro to programming with java
Java 101 intro to programming with java
 
Fundamentals of oop lecture 2
Fundamentals of oop lecture 2Fundamentals of oop lecture 2
Fundamentals of oop lecture 2
 
Presentation on java
Presentation  on  javaPresentation  on  java
Presentation on java
 
Hibernate introduction
Hibernate introductionHibernate introduction
Hibernate introduction
 
Java basic
Java basicJava basic
Java basic
 
1_JavIntro
1_JavIntro1_JavIntro
1_JavIntro
 
Advance Java
Advance JavaAdvance Java
Advance Java
 
Core Java
Core JavaCore Java
Core Java
 
Fundamentals of JAVA
Fundamentals of JAVAFundamentals of JAVA
Fundamentals of JAVA
 
Java training in delhi
Java training in delhiJava training in delhi
Java training in delhi
 
Core java lessons
Core java lessonsCore java lessons
Core java lessons
 
Java &amp; advanced java
Java &amp; advanced javaJava &amp; advanced java
Java &amp; advanced java
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language
 
Basics of java programming language
Basics of java programming languageBasics of java programming language
Basics of java programming language
 
Basic java tutorial
Basic java tutorialBasic java tutorial
Basic java tutorial
 
Java basic-tutorial for beginners
Java basic-tutorial for beginners Java basic-tutorial for beginners
Java basic-tutorial for beginners
 
Java Programming - 01 intro to java
Java Programming - 01 intro to javaJava Programming - 01 intro to java
Java Programming - 01 intro to java
 
Java 102 intro to object-oriented programming in java
Java 102   intro to object-oriented programming in javaJava 102   intro to object-oriented programming in java
Java 102 intro to object-oriented programming in java
 
Core java1
Core java1Core java1
Core java1
 
PROGRAMMING IN JAVA
PROGRAMMING IN JAVAPROGRAMMING IN JAVA
PROGRAMMING IN JAVA
 

Viewers also liked

Introduction to Jquery
Introduction to Jquery Introduction to Jquery
Introduction to Jquery Tajendar Arora
 
Challenges confronting the police institution in ghana by evans kojo acheampong
Challenges confronting the police institution in ghana by evans kojo acheampongChallenges confronting the police institution in ghana by evans kojo acheampong
Challenges confronting the police institution in ghana by evans kojo acheampongkojokay
 
Bus 402 week 5 discussion questions 1
Bus 402 week 5 discussion questions 1Bus 402 week 5 discussion questions 1
Bus 402 week 5 discussion questions 1tiviwader1988
 
Tal Solutions Talent Science Presentation_FINAL3
Tal Solutions Talent Science Presentation_FINAL3Tal Solutions Talent Science Presentation_FINAL3
Tal Solutions Talent Science Presentation_FINAL3Marcia Tal
 
Bus 402 week 3 discussion questions 2
Bus 402 week 3 discussion questions 2Bus 402 week 3 discussion questions 2
Bus 402 week 3 discussion questions 2goldfeschyrssmog1977
 
Einführung in die @4sqapi
Einführung in die @4sqapiEinführung in die @4sqapi
Einführung in die @4sqapiDaniel Wiegand
 
Unit 27 – task 2 coachs log
Unit 27 – task 2   coachs logUnit 27 – task 2   coachs log
Unit 27 – task 2 coachs logtaliaelisekaur
 
Digital marketing-training-institute
Digital marketing-training-instituteDigital marketing-training-institute
Digital marketing-training-institutesoftprostudent2
 

Viewers also liked (14)

Introduction to Jquery
Introduction to Jquery Introduction to Jquery
Introduction to Jquery
 
Challenges confronting the police institution in ghana by evans kojo acheampong
Challenges confronting the police institution in ghana by evans kojo acheampongChallenges confronting the police institution in ghana by evans kojo acheampong
Challenges confronting the police institution in ghana by evans kojo acheampong
 
Bus 402 week 5 discussion questions 1
Bus 402 week 5 discussion questions 1Bus 402 week 5 discussion questions 1
Bus 402 week 5 discussion questions 1
 
Formação Continuada
Formação ContinuadaFormação Continuada
Formação Continuada
 
11.measurement
11.measurement11.measurement
11.measurement
 
Tal Solutions Talent Science Presentation_FINAL3
Tal Solutions Talent Science Presentation_FINAL3Tal Solutions Talent Science Presentation_FINAL3
Tal Solutions Talent Science Presentation_FINAL3
 
The Power of Legacy
The Power of LegacyThe Power of Legacy
The Power of Legacy
 
hospitality
hospitalityhospitality
hospitality
 
Bus 402 week 3 discussion questions 2
Bus 402 week 3 discussion questions 2Bus 402 week 3 discussion questions 2
Bus 402 week 3 discussion questions 2
 
Einführung in die @4sqapi
Einführung in die @4sqapiEinführung in die @4sqapi
Einführung in die @4sqapi
 
CV CALUBAYAN LEAMOR L.
CV CALUBAYAN LEAMOR L.CV CALUBAYAN LEAMOR L.
CV CALUBAYAN LEAMOR L.
 
Unit 27 – task 2 coachs log
Unit 27 – task 2   coachs logUnit 27 – task 2   coachs log
Unit 27 – task 2 coachs log
 
Global277 279
Global277 279Global277 279
Global277 279
 
Digital marketing-training-institute
Digital marketing-training-instituteDigital marketing-training-institute
Digital marketing-training-institute
 

Similar to Java Fundamentals Guide: Introduction to Java, JVM, JDK, Data Types, Expressions, Control Statements (39

Java programming basics
Java programming basicsJava programming basics
Java programming basicsHamid Ghorbani
 
Core java introduction
Core java introductionCore java introduction
Core java introductionBeenu Gautam
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruNithin Kumar,VVCE, Mysuru
 
Introduction
IntroductionIntroduction
Introductionrichsoden
 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxMurugesh33
 
JAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxJAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxMurugesh33
 
Object Oriented Programming-JAVA
Object Oriented Programming-JAVAObject Oriented Programming-JAVA
Object Oriented Programming-JAVAHome
 
Java essentials for hadoop
Java essentials for hadoopJava essentials for hadoop
Java essentials for hadoopSeo Gyansha
 
Java programing language unit 1 introduction
Java programing language unit 1 introductionJava programing language unit 1 introduction
Java programing language unit 1 introductionchnrketan
 

Similar to Java Fundamentals Guide: Introduction to Java, JVM, JDK, Data Types, Expressions, Control Statements (39 (20)

Introduction to Core Java Programming
Introduction to Core Java ProgrammingIntroduction to Core Java Programming
Introduction to Core Java Programming
 
Introduction java programming
Introduction java programmingIntroduction java programming
Introduction java programming
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
 
Java1
Java1Java1
Java1
 
Java
Java Java
Java
 
Core java introduction
Core java introductionCore java introduction
Core java introduction
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, Mysuru
 
Introduction
IntroductionIntroduction
Introduction
 
Java platform
Java platformJava platform
Java platform
 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptx
 
JAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxJAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptx
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
OOP-Chap2.docx
OOP-Chap2.docxOOP-Chap2.docx
OOP-Chap2.docx
 
Object Oriented Programming-JAVA
Object Oriented Programming-JAVAObject Oriented Programming-JAVA
Object Oriented Programming-JAVA
 
Java essentials for hadoop
Java essentials for hadoopJava essentials for hadoop
Java essentials for hadoop
 
Java essentials for hadoop
Java essentials for hadoopJava essentials for hadoop
Java essentials for hadoop
 
What is Java? Presentation On Introduction To Core Java By PSK Technologies
What is Java? Presentation On Introduction To Core Java By PSK TechnologiesWhat is Java? Presentation On Introduction To Core Java By PSK Technologies
What is Java? Presentation On Introduction To Core Java By PSK Technologies
 
Unit-IV_Introduction to Java.pdf
Unit-IV_Introduction to Java.pdfUnit-IV_Introduction to Java.pdf
Unit-IV_Introduction to Java.pdf
 
Java programing language unit 1 introduction
Java programing language unit 1 introductionJava programing language unit 1 introduction
Java programing language unit 1 introduction
 
Java JDK.docx
Java JDK.docxJava JDK.docx
Java JDK.docx
 

Recently uploaded

Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 

Recently uploaded (20)

Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 

Java Fundamentals Guide: Introduction to Java, JVM, JDK, Data Types, Expressions, Control Statements (39

  • 2. OBJECTIVES  What is Java?  Why Java?  Java System overview and Types of programs in java  JVM  JDK  Primitive Data types in java  Expressions in java  Control Statements  Naming conventions  Arrays  For-each loop  Type casting  Build first basic java program  Command Line Arguments TajendarArora
  • 3. JAVA  Java is high level programming language introduced by Sun Microsystems in June 1995.  Java is an object oriented language built upon C & C++, It derived its object oriented features from C++.  The Java language has undergone several changes since JDK 1.0 (1996) and now JSE 7 is latest. *jdk- Java Development Kit *JSE- Java Standard Ediiton TajendarArora
  • 4. WHY JAVA  Object-oriented  Platform independent  Built-in support for multi-threading, socket communication and memory management  Supports Web based applications (Applet, Servlets and JSP)  Vast library of predefined objects and operations  Secure TajendarArora
  • 5. Tajendar Arora JAVA FEATURES  Simple and object oriented  Look and feel of C  Simplified object modeling  Portability  Java compiler generates byte codes  Runtime systems for various platforms  Size and behavior of basic data types defined  Write once, run/debug anywhere
  • 6. Tajendar Arora JAVA FEATURES CONT.  Availability  Windows, Linux, Solaris,…  Embedded systems  Compiler and runtime are free  Free IDEs: Eclipse, Netbeans  Library  Rich class library  Part of the definition  Standard GUI toolkit
  • 7. Tajendar Arora JAVA FEATURES CONT.  Built-in model for concurrency  Threads at the language level  Synchronization  Safety  No Pointer!  Automatic memory management – GC  Networking  Web Enabled
  • 9. APPLETS , SERVLETS AND APPLICATION  An applet is designed to be embedded in a Web page, and run by a browser.  A servlet is designed to be run by a web server which act as controller for we application.  An application is a conventional standalone program. TajendarArora
  • 10. Tajendar Arora WHAT IS A VIRTUAL MACHINE?  A virtual machine (VM) is an abstract computer architecture  Software on top of a real hardware  Can run the same application on different machines where the VM is available
  • 11. Tajendar Arora JVM CONT.  Runtime environment for Java  Implementation NOT defined  Runs Java .class files  Has to conform to Sun‘s specification
  • 12. JDK DIRECTORY STRUCTURE (JAVA INSTALLATIONS) Assuming the JDK software is installed at /jdk1.7.0, here are some of the most important directories: /jdk1.7.0Root directory of the JDK software installation. Contains copyright, license, and README files. ./jdk1.7.0/binExecutables for all the development tools contained in the JDK. The PATH environment variable should contain an entry for this directory. /jdk1.7.0/lib Files used by the development tools. Includes tools.jar, which contains non-core classes for support of the tools and utilities in the JDK. /jdk1.7.0/jre Root directory of the Java runtime environment used by the JDK development tools. The runtime environment is an implementation of the Java platform. TajendarArora
  • 13. PRIMITIVE DATA TYPES  Main data types are int, double, boolean, char  Also have byte, short, long, float  boolean has values true and false  Variable Declarations look like,  double x, y;  int count = 0; TajendarArora
  • 14. EXPRESSIONS  Assignment statements mostly look like those in C; you can use =, +=, *= etc.  Arithmetic uses the familiar + - * / %  Java also has ++ and --  Java has boolean operators && || !  Java has comparisons < <= == != >= >  Java does not have pointers or pointer arithmetic TajendarArora
  • 15. CONTROL STATEMENTS •if (x < y) smaller = x; •if (x < y){ smaller=x;sum += x;} else { smaller = y; sum += y; } •while (x < y) { y = y - x; } •do { y = y - x; } while (x < y) •for (int i = 0; i < max; i++) sum += i; BUT: conditions must be boolean TajendarArora
  • 16. NAMING CONVENTIONS Java is case-sensitive; maxval, maxVal, and MaxVal are three different names Class names begin with a capital letter All other names begin with a lowercase letter Subsequent words are capitalized: theBigOne Underscores are not used in names, These are very strong conventions. TajendarArora
  • 17. ARRAYS IN JAVA  Java provides a data structure, the array, which stores a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data.  Declare array  dataType[] arrayRefVar; // preferred way.  Creating Arrays:  You can create an array by using the new operator with the following syntax:  arrayRefVar = new dataType[arraySize]; The above statement does two things:  It creates an array using new dataType[arraySize];  It assigns the reference of the newly created array to the variable arrayRefVar. TajendarArora
  • 18. FOR EACH LOOP FOR ARRAYS IN JAVA  Since JDK 1.5 introduced a new for loop known as foreach loop or enhanced for loop, which enables you to traverse the complete array sequentially without using an index variable.  Example:  The following code displays all the elements in the array myList:  public class TestArray {  public static void main(String[] args) {  double[] myList = {1.9, 2.9, 3.4, 3.5};  // Print all the array elements  for (double element: myList)  { System.out.println(element);  } } } TajendarArora
  • 19. TYPE CASTING IN JAVA  Assigning a value of one type to a variable of another type is known as Type Casting.  In Java, type casting is classified into two types,  Widening Casting(Implicit)  Narrowing Casting(Explicitly done)  TajendarArora
  • 20. TYPE CASTING IN JAVA  Widening or Automatic type converion  Automatic Type casting take place when,the two types are compatible  the target type is larger than the source type  Example :  int i = 100;  long l = i;  Narrowing or Explicit type conversion  When you are assigning a larger type value to a variable of smaller type, then you need to perform explicit type casting.  double d = 100.04;  long l = (long)d;  //explicit type casting required int i = (int)l; TajendarArora
  • 21. BUILDING STANDALONE JAVA PROGRAMS  We can use different IDEs as well  IDEs are more complex and have visual Java development tools, tight integration with the compiler or application server, and may include tools for debugging, refactoring, version control, and so forth. Some examples below  Eclipse  NetBeans  BjueJ  Jbuilder TajendarArora
  • 22. BUILDING STANDALONE JAVA PROGRAMS  Prepare the file First.java using an editor  /*  This is a simple Java program.*/  class First  {  public static void main(String args[])  {  System.out.println("This is a simple Java program.");  }  }  Invoke the compiler: javac First.java  This creates First.class  Run the java interpreter: java First  println is a member function for the System.out class  String is built in class * File name should be First.java TajendarArora
  • 23. COMMAND LINE ARGUMENTS  A command-line argument is the information that directly follows the program’s name on the command line when it is executed. To access the command-line arguments inside a Java program is quite easy—they are stored as strings in the String array passed to main( ).  class CommandLine {  public static void main(String args[]) {  for(int i=0; i<args.length; i++)  System.out.println("args[" + i + "]: " +args[i]);  }  }  * length returns the length of array TajendarArora