SlideShare a Scribd company logo
PRESENTED BY:
RISHABH GUPTA
BTECH(CSE-D)
ROLLNO:27
•www.edx.org
•Start Date:-January 16 2018
•End Date:-April 1 2018
CONTENTS
INTRODUCTION
Difference between JAVA & C
Data types in Java
Control Statements
Conclusion
 Program
Loops
What is Java?
A most popular programming language
developed by James Gosling
Object Oriented
A simple, object oriented, distributed, interpreted,
robust, secure, WORA(Write Once Run Anywhere),
portable, high performance, multithreaded, dynamic
language.
Some History
 1993 Oak project at Sun
 small, robust, architecture independent, Object-Oriented, language to
control interactive TV.
 didn’t go anywhere
 1995 Oak becomes Java
 Focus on the web
 1996 Java 1.0 available
 1997 (March) Java 1.1 - some language changes, much larger library, new
event handling model
 1997 (September) Java 1.2 beta – huge increase in libraries including
Swing, new collection classes, J2EE
 1998 (October) Java 1.2 final (Java2!)
 2000 (April) Java 1.3 final
 2001 Java 1.4 final (assert)
 2004 Java 1.5 (parameterized types, enum, …) (Java5!)
 2005 J2EE 1.5
Features of Java
Simple
Architecture-neutral
Object-Oriented
Distributed
Compiled
Interpreted
Multi-Threaded
Garbage Collected
Portable
High-Performance
Robust
Secure
Extensible
Well-Understood
Difference between JAVA & C
JAVA is Object-Oriented while C is procedural. Different Paradigms,
that is.
 Java is an Interpreted language while C is a compiled language.
 C is a low-level language while JAVA is a high-level language.
 C uses the top-down {sharp & smooth} approach while JAVA uses
the bottom-up {on the rocks} approach.
 Pointer go backstage in JAVA while C requires explicit handling of
pointers.
 JAVA supports Method Overloading while C does not support
overloading at all.
Unlike C, JAVA does not support Preprocessors, & does not really
them.
Data types
There are eight basic data types in JAVA :
 char – to store a character(1 byte).
 int – to store an integer value(4 bytes).
 float – to store a floating point number(4 bytes).
 double –to store a double precision floating point
number(8 bytes).
 Long
 Short
Java basics
if
if statement:
Executes a set of commands only if a certain condition is true.
Otherwise, the commands are skipped.
Syntax:
if(condition)
{
statements
}
Example:
if(age>=18)
System.out.println(“You can vote”);
if/else
if/else statement:
Executes one set of statements if a certain condition is True, and a second
set if it is False.
Syntax:
if(condition)
statements;
else
statements;
Example:
if (a < 10)
System.out.println(“a is less than 10n”);
else if (a == 10)
System.out.println(“a is 10n”);
else
System.out.println(“a is greater than 10n”);
Switch
int c = 10;
switch (c)
{
case 0:
printf(“c is 0n”);
break;
……
default:
printf(“Unknown value of cn”);
break;
}
Java basics
for loops
 It executes a particular set of statements specified number of times.
 Depending on the language mode, you may not be able to declare variable inside
a for-loop definition:
Syntax:
declaration
for(initialisation;condition;updation)
statements;
Example:
int i;
for (i = 0; i < 10; i++)
{
printf(“%d n”, i);
}
PROGRAM
# Program to print “Hello World”.
class World
{
public static void main(String[]args)
{
System.out.println(“Hello, Worldn");
}}
Java basics

More Related Content

PPTX
A brief introduction to lisp language
PPTX
C vs JAVA.pptx
DOCX
java introduction.docx
PPTX
Java basic
PPT
Java ppt-class_Introduction_class_Objects.ppt
PPTX
c vs java (2).pptx
PPT
Java ppt-class_basic data types methods definitions
PPT
JAVA_BASICS.ppt
A brief introduction to lisp language
C vs JAVA.pptx
java introduction.docx
Java basic
Java ppt-class_Introduction_class_Objects.ppt
c vs java (2).pptx
Java ppt-class_basic data types methods definitions
JAVA_BASICS.ppt

Similar to Java basics (20)

PDF
OOPS JAVA.pdf
PPT
JAVA_BASICS_Data_abstraction_encapsulation.ppt
PDF
java notes.pdf
PPT
javaeanjjisjejrehurfhjhjfeauojksfjdi.ppt
PPT
Introduction to Java Programming, Basic Structure, variables Data type, input...
PPTX
Introduction to java
PDF
Java notes | All Basics |
PPT
GETTING STARTED WITH JAVA(beginner)
PPT
introduction_to_core_elementry_java-1.ppt
PPTX
Java. converted (2)
PPTX
java slides
PPTX
Basics java programing
PPTX
Introduction to java
PPTX
Java Technologies notes of unit 1 and 2.
PPTX
Knowledge of Javascript
PPTX
JAVA introduction and basic understanding.pptx
PPTX
UNIT 1 Programming in java Bsc program.pptx
PPTX
Java Introduction
PPTX
Let's start with Java- Basic Concepts
PPTX
Java Basics in Mule
OOPS JAVA.pdf
JAVA_BASICS_Data_abstraction_encapsulation.ppt
java notes.pdf
javaeanjjisjejrehurfhjhjfeauojksfjdi.ppt
Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to java
Java notes | All Basics |
GETTING STARTED WITH JAVA(beginner)
introduction_to_core_elementry_java-1.ppt
Java. converted (2)
java slides
Basics java programing
Introduction to java
Java Technologies notes of unit 1 and 2.
Knowledge of Javascript
JAVA introduction and basic understanding.pptx
UNIT 1 Programming in java Bsc program.pptx
Java Introduction
Let's start with Java- Basic Concepts
Java Basics in Mule
Ad

Recently uploaded (20)

PPTX
Geodesy 1.pptx...............................................
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
composite construction of structures.pdf
PDF
Well-logging-methods_new................
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
OOP with Java - Java Introduction (Basics)
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
PPT on Performance Review to get promotions
PPT
Project quality management in manufacturing
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
Construction Project Organization Group 2.pptx
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Geodesy 1.pptx...............................................
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
composite construction of structures.pdf
Well-logging-methods_new................
Internet of Things (IOT) - A guide to understanding
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
OOP with Java - Java Introduction (Basics)
Operating System & Kernel Study Guide-1 - converted.pdf
PPT on Performance Review to get promotions
Project quality management in manufacturing
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Automation-in-Manufacturing-Chapter-Introduction.pdf
Construction Project Organization Group 2.pptx
Embodied AI: Ushering in the Next Era of Intelligent Systems
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
bas. eng. economics group 4 presentation 1.pptx
R24 SURVEYING LAB MANUAL for civil enggi
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Ad

Java basics

  • 2. •www.edx.org •Start Date:-January 16 2018 •End Date:-April 1 2018
  • 3. CONTENTS INTRODUCTION Difference between JAVA & C Data types in Java Control Statements Conclusion  Program Loops
  • 4. What is Java? A most popular programming language developed by James Gosling Object Oriented A simple, object oriented, distributed, interpreted, robust, secure, WORA(Write Once Run Anywhere), portable, high performance, multithreaded, dynamic language.
  • 5. Some History  1993 Oak project at Sun  small, robust, architecture independent, Object-Oriented, language to control interactive TV.  didn’t go anywhere  1995 Oak becomes Java  Focus on the web  1996 Java 1.0 available  1997 (March) Java 1.1 - some language changes, much larger library, new event handling model  1997 (September) Java 1.2 beta – huge increase in libraries including Swing, new collection classes, J2EE  1998 (October) Java 1.2 final (Java2!)  2000 (April) Java 1.3 final  2001 Java 1.4 final (assert)  2004 Java 1.5 (parameterized types, enum, …) (Java5!)  2005 J2EE 1.5
  • 6. Features of Java Simple Architecture-neutral Object-Oriented Distributed Compiled Interpreted Multi-Threaded Garbage Collected Portable High-Performance Robust Secure Extensible Well-Understood
  • 7. Difference between JAVA & C JAVA is Object-Oriented while C is procedural. Different Paradigms, that is.  Java is an Interpreted language while C is a compiled language.  C is a low-level language while JAVA is a high-level language.  C uses the top-down {sharp & smooth} approach while JAVA uses the bottom-up {on the rocks} approach.  Pointer go backstage in JAVA while C requires explicit handling of pointers.  JAVA supports Method Overloading while C does not support overloading at all. Unlike C, JAVA does not support Preprocessors, & does not really them.
  • 8. Data types There are eight basic data types in JAVA :  char – to store a character(1 byte).  int – to store an integer value(4 bytes).  float – to store a floating point number(4 bytes).  double –to store a double precision floating point number(8 bytes).  Long  Short
  • 10. if if statement: Executes a set of commands only if a certain condition is true. Otherwise, the commands are skipped. Syntax: if(condition) { statements } Example: if(age>=18) System.out.println(“You can vote”);
  • 11. if/else if/else statement: Executes one set of statements if a certain condition is True, and a second set if it is False. Syntax: if(condition) statements; else statements; Example: if (a < 10) System.out.println(“a is less than 10n”); else if (a == 10) System.out.println(“a is 10n”); else System.out.println(“a is greater than 10n”);
  • 12. Switch int c = 10; switch (c) { case 0: printf(“c is 0n”); break; …… default: printf(“Unknown value of cn”); break; }
  • 14. for loops  It executes a particular set of statements specified number of times.  Depending on the language mode, you may not be able to declare variable inside a for-loop definition: Syntax: declaration for(initialisation;condition;updation) statements; Example: int i; for (i = 0; i < 10; i++) { printf(“%d n”, i); }
  • 15. PROGRAM # Program to print “Hello World”. class World { public static void main(String[]args) { System.out.println(“Hello, Worldn"); }}