SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
DATA TYPES AND OPERATORS
AND STATEMENTS
Data types
2




                 Prof. Ashish Bhatia
Byte Ordering
3
                                          JAVA




        x86 and
          x64
                    Prof. Ashish Bhatia
Floating Points - float
4


       Float [ 8byte = 64 bits]
       123.45 ? What is exponent and Significand
         31 – Sign Bit [ 1 bit ]
         23-30 – Exponent Field [ 8 bit ]

         0-22 - Significand [23 bit]




                                   Prof. Ashish Bhatia
Floating Points
5


       Float [ 4byte = 32 bits]
           Bits 30-23                 Bits 0-22 Significand
           Exponent

    0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0


           Bits 30-23                 Bits 0-22 Significand
           Exponent

    1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0


           Bits 30-23                 Bits 0-22 Significand
           Exponent

    1 1 1 1 1 1 1 1 1                 Any Non – zero value
                                   Prof. Ashish Bhatia
Floating Points - double
6


         Bits 62-52                  Bits 51-0 Significand
         Exponent

    0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0


         Bits 62-52                  Bits 51-0 Significand
         Exponent

    1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0


         Bits 62-52                  Bits 51-0 Significand
         Exponent

    1 1 1 1 1 1 1 1 1                  Any non-zero value

                                  Prof. Ashish Bhatia
Super Type and Sub Type Relations
7


                     double


                         float


                         long


                          int


                 short           char


                 byte

                          Prof. Ashish Bhatia
Using Literals
8


       Use l or L for long values else everything is int.
       Use f or F for Float values else everything is double.
       For Octal use 0
       For Hex use 0x or 0X
        used for special characters
       ‘n’ = New Line
       ‘t’ = Tab
       ‘017’ = Character constant

                                 Prof. Ashish Bhatia
Legal Identifiers
9


       Must start with a letter, a currency character ($), or
        a connecting character such as the underscore ( _ ).
        Identifiers cannot start with a number!
       After the first character, identifiers can contain any
        combination of letters, currency characters,
        connecting characters, or numbers.
       In practice, there is no limit to the number of
        characters an identifier can contain.
       Identifiers in Java are case-sensitive; foo and FOO
        are two different identifiers.
                                  Prof. Ashish Bhatia
Example
10


        int _a;
        int $c;
        int ______2_w;
        int _$;
        int this_is_a_very_detailed_name_for_an_;
        int :b;
        int -d;
        int e#;
        int .f;
        int 7g;

                                  Prof. Ashish Bhatia
Unicode Escape in Java
11


        ufour hex number
        u0A85




                             Prof. Ashish Bhatia
Reference Datatypes
12


        Arrays
        Classes
        Interface
        Enum
        Annotation




                      Prof. Ashish Bhatia
Operators
13


        Arithmetic Operators
         +   - * / %


        Conversion
          Widening
            Sub   type to super type
          Narrowing
            Super   Type to sub type
          Mixed    Conversion

                                        Prof. Ashish Bhatia
Operators
14


        Unary + and –
        String Concatenation




                                Prof. Ashish Bhatia
Operator
15


        Relational Operator
            < > <= >= ==      !=
        Logical Operator
            & | ^ !   && ||
        Bitwise Operator
            & | ^ ~   << >> >>>
        Increment and Decrement Operator [ ++ , -- ]
        Conditional Operator (? : )
        Assignment Operator
        instanceof
        new
                                    Prof. Ashish Bhatia
Example
16


        int a = 60; /* 60 = 0011 1100 */
        int c = a << 2; /* 240 = 1111 0000 */
        int c = a >> 2; /* 15 = 1111 */
        int c = a >>> 2; /* 215 = 0000 1111 */

        What is int a = -60?




                                Prof. Ashish Bhatia
Statements
17


        Conditional
          if,   if-else, switch-case
        Loop
          for,   while, do-while
        break, continue, return
        Labeled break and continue




                                        Prof. Ashish Bhatia
Brain Teasing Exercise
18


        x*=2+5
        boolean b = 100 > 99;
        5.0 == 5L
        if(x=0) {}
        if(b){}
        if(5 && 6) {}
        int x = 1;
         int y=++x; // x++
         System.out.println(y);

                          Prof. Ashish Bhatia
Output
19


        class Test{
         public static void main(String[] args) {
         int i = 42;
         String s =
         (i<40)?"life":(i>50)?"universe":"everyth
         ing";
         System.out.println(s);
         }
     }

                            Prof. Ashish Bhatia
Output
20


     String s = "";
     boolean b1 = true;
     boolean b2 = false;
     if((b2 = false) | (21%5) > 2) s += "x";
     if(b1 || (b2 = true)) s += "y";
     if(b2 == true) s += "z";
     System.out.println(s);


                        Prof. Ashish Bhatia
More on Arrays
21


        int [] array; // recommended
        int array[];
        int [5] array; // ERROR
        Declaring an Array
        Constructing an Array
        int array[] = new Array[]
        int array[] = {1,2,3}
        int z[] = new int[] {1,2,3}
        int z[] = new int[3] {1,2,3}
                          Prof. Ashish Bhatia
Getting user input
22

     import java.util.Scanner;
     class Scan
     {
       public static void main(String args[])
       {
           Scanner s = new Scanner(System.in);
           int x = s.nextInt();
           System.out.println(x);
           x = s.nextInt();
           System.out.println(x);
       }
     }

                              Prof. Ashish Bhatia

Weitere ähnliche Inhalte

Was ist angesagt?

BCA_Semester-II-Discrete Mathematics_unit-iii_Lattices and boolean algebra
BCA_Semester-II-Discrete Mathematics_unit-iii_Lattices and boolean algebraBCA_Semester-II-Discrete Mathematics_unit-iii_Lattices and boolean algebra
BCA_Semester-II-Discrete Mathematics_unit-iii_Lattices and boolean algebraRai University
 
PRAGRAMMING IN JAVA (BEGINNER)
PRAGRAMMING IN JAVA (BEGINNER)PRAGRAMMING IN JAVA (BEGINNER)
PRAGRAMMING IN JAVA (BEGINNER)HarshithaAllu
 
Subject seminar boolean algebra by :-shivanshu
Subject seminar  boolean algebra  by :-shivanshuSubject seminar  boolean algebra  by :-shivanshu
Subject seminar boolean algebra by :-shivanshuShivanshu Dixit
 
Beauty and/or elegance in functional programming
Beauty and/or elegance in functional programmingBeauty and/or elegance in functional programming
Beauty and/or elegance in functional programmingSilviaP24
 
Boolean algebra And Logic Gates
Boolean algebra And Logic GatesBoolean algebra And Logic Gates
Boolean algebra And Logic GatesKumar
 
2nd PUC computer science chapter 2 boolean algebra
2nd PUC computer science chapter 2  boolean algebra 2nd PUC computer science chapter 2  boolean algebra
2nd PUC computer science chapter 2 boolean algebra Aahwini Esware gowda
 
02. Data Types and variables
02. Data Types and variables02. Data Types and variables
02. Data Types and variablesIntro C# Book
 
Boolean Algebra
Boolean AlgebraBoolean Algebra
Boolean AlgebraHau Moy
 
19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm Complexity19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm ComplexityIntro C# Book
 
Basic theorems and properties of boolean algebra
Basic theorems and properties of boolean algebraBasic theorems and properties of boolean algebra
Basic theorems and properties of boolean algebraHanu Kavi
 
SOP POS, Minterm and Maxterm
SOP POS, Minterm and MaxtermSOP POS, Minterm and Maxterm
SOP POS, Minterm and MaxtermSelf-employed
 

Was ist angesagt? (20)

Boolean algebra & logic gates
Boolean algebra & logic gatesBoolean algebra & logic gates
Boolean algebra & logic gates
 
BCA_Semester-II-Discrete Mathematics_unit-iii_Lattices and boolean algebra
BCA_Semester-II-Discrete Mathematics_unit-iii_Lattices and boolean algebraBCA_Semester-II-Discrete Mathematics_unit-iii_Lattices and boolean algebra
BCA_Semester-II-Discrete Mathematics_unit-iii_Lattices and boolean algebra
 
PRAGRAMMING IN JAVA (BEGINNER)
PRAGRAMMING IN JAVA (BEGINNER)PRAGRAMMING IN JAVA (BEGINNER)
PRAGRAMMING IN JAVA (BEGINNER)
 
Theory of computing
Theory of computingTheory of computing
Theory of computing
 
13 Boolean Algebra
13 Boolean Algebra13 Boolean Algebra
13 Boolean Algebra
 
Subject seminar boolean algebra by :-shivanshu
Subject seminar  boolean algebra  by :-shivanshuSubject seminar  boolean algebra  by :-shivanshu
Subject seminar boolean algebra by :-shivanshu
 
JAVA PROGRAMMING : Data types
JAVA PROGRAMMING : Data typesJAVA PROGRAMMING : Data types
JAVA PROGRAMMING : Data types
 
Boolean+logic
Boolean+logicBoolean+logic
Boolean+logic
 
Boolean algebra and Logic gates
Boolean algebra and Logic gatesBoolean algebra and Logic gates
Boolean algebra and Logic gates
 
Token and operators
Token and operatorsToken and operators
Token and operators
 
Beauty and/or elegance in functional programming
Beauty and/or elegance in functional programmingBeauty and/or elegance in functional programming
Beauty and/or elegance in functional programming
 
Boolean algebra And Logic Gates
Boolean algebra And Logic GatesBoolean algebra And Logic Gates
Boolean algebra And Logic Gates
 
Theory of computation Lec1
Theory of computation Lec1Theory of computation Lec1
Theory of computation Lec1
 
2nd PUC computer science chapter 2 boolean algebra
2nd PUC computer science chapter 2  boolean algebra 2nd PUC computer science chapter 2  boolean algebra
2nd PUC computer science chapter 2 boolean algebra
 
02. Data Types and variables
02. Data Types and variables02. Data Types and variables
02. Data Types and variables
 
Boolean Algebra
Boolean AlgebraBoolean Algebra
Boolean Algebra
 
Ch 5 boolean logic
Ch 5 boolean logicCh 5 boolean logic
Ch 5 boolean logic
 
19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm Complexity19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm Complexity
 
Basic theorems and properties of boolean algebra
Basic theorems and properties of boolean algebraBasic theorems and properties of boolean algebra
Basic theorems and properties of boolean algebra
 
SOP POS, Minterm and Maxterm
SOP POS, Minterm and MaxtermSOP POS, Minterm and Maxterm
SOP POS, Minterm and Maxterm
 

Andere mochten auch

Java packages and access specifiers
Java packages and access specifiersJava packages and access specifiers
Java packages and access specifiersasbasb82
 
Circuítos kirchhoff
Circuítos kirchhoffCircuítos kirchhoff
Circuítos kirchhoffAna Alvarez
 
Fin Multiple Sectors
Fin Multiple SectorsFin Multiple Sectors
Fin Multiple Sectorsdkluka
 
Bedrijfspresentatie Rah Arbo
Bedrijfspresentatie Rah ArboBedrijfspresentatie Rah Arbo
Bedrijfspresentatie Rah ArboSaskia Gorissen
 
BlueBridge Overview
BlueBridge OverviewBlueBridge Overview
BlueBridge Overviewpbojovic
 
2nodesoracle12craconyourlaptopvirtualboxstepbystepguide1 0-130627143310-phpapp02
2nodesoracle12craconyourlaptopvirtualboxstepbystepguide1 0-130627143310-phpapp022nodesoracle12craconyourlaptopvirtualboxstepbystepguide1 0-130627143310-phpapp02
2nodesoracle12craconyourlaptopvirtualboxstepbystepguide1 0-130627143310-phpapp02shaikyunus1980
 
IVVpresentation1109
IVVpresentation1109IVVpresentation1109
IVVpresentation1109convents
 
The rule of 7 adn 10/20/30
The rule of 7 adn 10/20/30The rule of 7 adn 10/20/30
The rule of 7 adn 10/20/30guest3fe6f1
 
Copy Of Diss
Copy Of DissCopy Of Diss
Copy Of Disssuhtomor
 
Overall Cancer Incident
Overall Cancer Incident Overall Cancer Incident
Overall Cancer Incident UCSI University
 
A sample data visualisation web application
A sample data visualisation web applicationA sample data visualisation web application
A sample data visualisation web applicationsandugandhi
 

Andere mochten auch (17)

Hidráulica
HidráulicaHidráulica
Hidráulica
 
Java packages and access specifiers
Java packages and access specifiersJava packages and access specifiers
Java packages and access specifiers
 
Magnetismo
MagnetismoMagnetismo
Magnetismo
 
Circuítos kirchhoff
Circuítos kirchhoffCircuítos kirchhoff
Circuítos kirchhoff
 
Fin Multiple Sectors
Fin Multiple SectorsFin Multiple Sectors
Fin Multiple Sectors
 
Lehte Hainsalu
Lehte HainsaluLehte Hainsalu
Lehte Hainsalu
 
Lehte Hainsalu
Lehte HainsaluLehte Hainsalu
Lehte Hainsalu
 
Bedrijfspresentatie Rah Arbo
Bedrijfspresentatie Rah ArboBedrijfspresentatie Rah Arbo
Bedrijfspresentatie Rah Arbo
 
BlueBridge Overview
BlueBridge OverviewBlueBridge Overview
BlueBridge Overview
 
2nodesoracle12craconyourlaptopvirtualboxstepbystepguide1 0-130627143310-phpapp02
2nodesoracle12craconyourlaptopvirtualboxstepbystepguide1 0-130627143310-phpapp022nodesoracle12craconyourlaptopvirtualboxstepbystepguide1 0-130627143310-phpapp02
2nodesoracle12craconyourlaptopvirtualboxstepbystepguide1 0-130627143310-phpapp02
 
IVVpresentation1109
IVVpresentation1109IVVpresentation1109
IVVpresentation1109
 
The rule of 7 adn 10/20/30
The rule of 7 adn 10/20/30The rule of 7 adn 10/20/30
The rule of 7 adn 10/20/30
 
Lehte Hainsalu
Lehte HainsaluLehte Hainsalu
Lehte Hainsalu
 
Copy Of Diss
Copy Of DissCopy Of Diss
Copy Of Diss
 
Overall Cancer Incident
Overall Cancer Incident Overall Cancer Incident
Overall Cancer Incident
 
What is a Heart Attack
What is a Heart AttackWhat is a Heart Attack
What is a Heart Attack
 
A sample data visualisation web application
A sample data visualisation web applicationA sample data visualisation web application
A sample data visualisation web application
 

Ähnlich wie Data types and operators and statements

Chapter 2&3 (java fundamentals and Control Structures).ppt
Chapter 2&3 (java fundamentals and Control Structures).pptChapter 2&3 (java fundamentals and Control Structures).ppt
Chapter 2&3 (java fundamentals and Control Structures).ppthenokmetaferia1
 
Towards Programming Languages for Reasoning.pptx
Towards Programming Languages for Reasoning.pptxTowards Programming Languages for Reasoning.pptx
Towards Programming Languages for Reasoning.pptxmarkmarron7
 
Csharp4 operators and_casts
Csharp4 operators and_castsCsharp4 operators and_casts
Csharp4 operators and_castsAbed Bukhari
 
Boost.Interfaces
Boost.InterfacesBoost.Interfaces
Boost.Interfacesmelpon
 
Python for text processing
Python for text processingPython for text processing
Python for text processingXiang Li
 
03 and 04 .Operators, Expressions, working with the console and conditional s...
03 and 04 .Operators, Expressions, working with the console and conditional s...03 and 04 .Operators, Expressions, working with the console and conditional s...
03 and 04 .Operators, Expressions, working with the console and conditional s...Intro C# Book
 
Chapter 4 Mathematical Functions, Characters, and Strings.pptx
Chapter 4 Mathematical Functions, Characters, and Strings.pptxChapter 4 Mathematical Functions, Characters, and Strings.pptx
Chapter 4 Mathematical Functions, Characters, and Strings.pptxssusere3b1a2
 

Ähnlich wie Data types and operators and statements (14)

Java script
Java scriptJava script
Java script
 
Java - Operators
Java - OperatorsJava - Operators
Java - Operators
 
Java 2
Java 2Java 2
Java 2
 
Chapter 2&3 (java fundamentals and Control Structures).ppt
Chapter 2&3 (java fundamentals and Control Structures).pptChapter 2&3 (java fundamentals and Control Structures).ppt
Chapter 2&3 (java fundamentals and Control Structures).ppt
 
c_tutorial_2.ppt
c_tutorial_2.pptc_tutorial_2.ppt
c_tutorial_2.ppt
 
Towards Programming Languages for Reasoning.pptx
Towards Programming Languages for Reasoning.pptxTowards Programming Languages for Reasoning.pptx
Towards Programming Languages for Reasoning.pptx
 
Python programming
Python  programmingPython  programming
Python programming
 
Csharp4 operators and_casts
Csharp4 operators and_castsCsharp4 operators and_casts
Csharp4 operators and_casts
 
Boost.Interfaces
Boost.InterfacesBoost.Interfaces
Boost.Interfaces
 
Bit manipulation
Bit manipulationBit manipulation
Bit manipulation
 
Python for text processing
Python for text processingPython for text processing
Python for text processing
 
03 and 04 .Operators, Expressions, working with the console and conditional s...
03 and 04 .Operators, Expressions, working with the console and conditional s...03 and 04 .Operators, Expressions, working with the console and conditional s...
03 and 04 .Operators, Expressions, working with the console and conditional s...
 
05 operators
05   operators05   operators
05 operators
 
Chapter 4 Mathematical Functions, Characters, and Strings.pptx
Chapter 4 Mathematical Functions, Characters, and Strings.pptxChapter 4 Mathematical Functions, Characters, and Strings.pptx
Chapter 4 Mathematical Functions, Characters, and Strings.pptx
 

Kürzlich hochgeladen

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 

Kürzlich hochgeladen (20)

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 

Data types and operators and statements

  • 1. DATA TYPES AND OPERATORS AND STATEMENTS
  • 2. Data types 2 Prof. Ashish Bhatia
  • 3. Byte Ordering 3 JAVA x86 and x64 Prof. Ashish Bhatia
  • 4. Floating Points - float 4  Float [ 8byte = 64 bits]  123.45 ? What is exponent and Significand  31 – Sign Bit [ 1 bit ]  23-30 – Exponent Field [ 8 bit ]  0-22 - Significand [23 bit] Prof. Ashish Bhatia
  • 5. Floating Points 5  Float [ 4byte = 32 bits] Bits 30-23 Bits 0-22 Significand Exponent 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Bits 30-23 Bits 0-22 Significand Exponent 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Bits 30-23 Bits 0-22 Significand Exponent 1 1 1 1 1 1 1 1 1 Any Non – zero value Prof. Ashish Bhatia
  • 6. Floating Points - double 6 Bits 62-52 Bits 51-0 Significand Exponent 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Bits 62-52 Bits 51-0 Significand Exponent 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Bits 62-52 Bits 51-0 Significand Exponent 1 1 1 1 1 1 1 1 1 Any non-zero value Prof. Ashish Bhatia
  • 7. Super Type and Sub Type Relations 7 double float long int short char byte Prof. Ashish Bhatia
  • 8. Using Literals 8  Use l or L for long values else everything is int.  Use f or F for Float values else everything is double.  For Octal use 0  For Hex use 0x or 0X  used for special characters  ‘n’ = New Line  ‘t’ = Tab  ‘017’ = Character constant Prof. Ashish Bhatia
  • 9. Legal Identifiers 9  Must start with a letter, a currency character ($), or a connecting character such as the underscore ( _ ). Identifiers cannot start with a number!  After the first character, identifiers can contain any combination of letters, currency characters, connecting characters, or numbers.  In practice, there is no limit to the number of characters an identifier can contain.  Identifiers in Java are case-sensitive; foo and FOO are two different identifiers. Prof. Ashish Bhatia
  • 10. Example 10  int _a;  int $c;  int ______2_w;  int _$;  int this_is_a_very_detailed_name_for_an_;  int :b;  int -d;  int e#;  int .f;  int 7g; Prof. Ashish Bhatia
  • 11. Unicode Escape in Java 11  ufour hex number  u0A85 Prof. Ashish Bhatia
  • 12. Reference Datatypes 12  Arrays  Classes  Interface  Enum  Annotation Prof. Ashish Bhatia
  • 13. Operators 13  Arithmetic Operators + - * / %  Conversion  Widening  Sub type to super type  Narrowing  Super Type to sub type  Mixed Conversion Prof. Ashish Bhatia
  • 14. Operators 14  Unary + and –  String Concatenation Prof. Ashish Bhatia
  • 15. Operator 15  Relational Operator  < > <= >= == !=  Logical Operator  & | ^ ! && ||  Bitwise Operator  & | ^ ~ << >> >>>  Increment and Decrement Operator [ ++ , -- ]  Conditional Operator (? : )  Assignment Operator  instanceof  new Prof. Ashish Bhatia
  • 16. Example 16  int a = 60; /* 60 = 0011 1100 */  int c = a << 2; /* 240 = 1111 0000 */  int c = a >> 2; /* 15 = 1111 */  int c = a >>> 2; /* 215 = 0000 1111 */  What is int a = -60? Prof. Ashish Bhatia
  • 17. Statements 17  Conditional  if, if-else, switch-case  Loop  for, while, do-while  break, continue, return  Labeled break and continue Prof. Ashish Bhatia
  • 18. Brain Teasing Exercise 18  x*=2+5  boolean b = 100 > 99;  5.0 == 5L  if(x=0) {}  if(b){}  if(5 && 6) {}  int x = 1; int y=++x; // x++ System.out.println(y); Prof. Ashish Bhatia
  • 19. Output 19  class Test{ public static void main(String[] args) { int i = 42; String s = (i<40)?"life":(i>50)?"universe":"everyth ing"; System.out.println(s); } } Prof. Ashish Bhatia
  • 20. Output 20 String s = ""; boolean b1 = true; boolean b2 = false; if((b2 = false) | (21%5) > 2) s += "x"; if(b1 || (b2 = true)) s += "y"; if(b2 == true) s += "z"; System.out.println(s); Prof. Ashish Bhatia
  • 21. More on Arrays 21  int [] array; // recommended  int array[];  int [5] array; // ERROR  Declaring an Array  Constructing an Array  int array[] = new Array[]  int array[] = {1,2,3}  int z[] = new int[] {1,2,3}  int z[] = new int[3] {1,2,3} Prof. Ashish Bhatia
  • 22. Getting user input 22 import java.util.Scanner; class Scan { public static void main(String args[]) { Scanner s = new Scanner(System.in); int x = s.nextInt(); System.out.println(x); x = s.nextInt(); System.out.println(x); } } Prof. Ashish Bhatia