0% found this document useful (0 votes)
1 views2 pages

Java Values DataTypes Notes

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views2 pages

Java Values DataTypes Notes

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ICSE Class 9 Quick Notes

Java – Values & Data Types


① Character Set & ASCII Code
A Character Set is a collection of all letters, digits, and special ASCII Table Sections:
characters used in a program.
Section Range Description
• Letters: A–Z / a–z | Digits: 0–9 | Symbols: %, &, ^, @, $, |…
Non-Printable 0–31 System/control codes
Encoding Systems:
Lower ASCII 32–127 English chars (7-bit)
System Full Form Size Range
Higher ASCII 128–255 OS-dependent chars
ASCII American Standard Code for Info. Interchange
8 bits (1 byte) 0–255

ISCII Indian Standard Code for Info. Interchange


8 bits Unicode
0–255 Key Values:
Unicode Universal Code (Java uses this) 16 bits (2 bytes) Chars
0–65,535 Unicode Range

A–Z 65–90

a–z 97–122

0–9 48–57

② Tokens – Building Blocks of Java

TOKENS

Keywords Identifiers Literals Operators Punctuators


Keywords Identifiers Literals Operators Punctuators

Integer
Float
Boolean
CharStringNullClass

Fig. 1 – Java Token Hierarchy

③ Keywords & Identifiers


Keywords – 50 reserved words; cannot be used as identifiers. Identifier Rules:
abstract assert boolean break byte case catch 1. Can use letters, digits, underscore (_), dollar ($)
char class const continue default do double
2. Cannot start with a digit
3. No spaces or special chars (#, @…)
else enum extends final finally float for
4. Cannot be a keyword
goto if implements import instanceof int 5. Case-sensitive (Marks ≠ marks)
interface

long native new package private protected public


Naming Conventions:
return short static strictfp super switch synchronized
Element Convention Example
this throw throws transient try void volatile
Method / Variable camelCase sumOfNumbers
while – – – true* false* null*
Class PascalCase BankAccount
*true, false, null are literals, not keywords.
Constant UPPER_CASE MAX_VALUE, PI
Java – Values & Data Types | Page 2
④ Data Types Hierarchy

Data Types

Primitive Reference

class array interfaceString


Integer Fraction Char Bool

byte short int long float double char boolean


8b 16b 32b 64b 32b 64b 16b 8b

Fig. 2 – Java Data Type Hierarchy

⑤ Primitive Data Types – Quick Reference


Type Category Size Range / Values Default Example

byte Integer 8 bits -128 to 127 0 byte x=10;

short Integer 16 bits -32768 to 32767 0 short s=500;

int Integer 32 bits -2<super>31</super> to 2<super>31</super>-1


0 int n=100;

long Integer 64 bits -2<super>63</super> to 2<super>63</super>-1


0L long l=99L;

float Fractional 32 bits ±3.4E-38 to ±3.4E+38 0.0f float f=2.6f;

double Fractional 64 bits ±1.7E-308 to ±1.7E+308 0.0d double d=2.6;

char Character 16 bits Unicode 0–65,535 '\u0000' char c='A';

boolean Boolean 8 bits true or false false boolean b=true;

⑥ Literals, Variables & Type Conversion


Literals – fixed/constant values in code. Variables & Constants
Literal Type Memory Example Declaration: <data-type> <variable-name>;
e.g. int a; float e, f; double d, m;
Integer (Decimal) – 3625, -12
Symbolic Constant: final double PI = 3.142;
Integer (Octal) – 056, 0756

Integer (Hex) – 0x56, 0xAB5 Type Conversion


Type Direction Notes
Float / Double – 12.36, 14.275
Implicit Done by JVM; no data loss
Exponential – 23.6E-3, 0.00236E2 Lower → Higher
(Widening) e.g. int x=10; double y=x;
Boolean 1 byte true, false
Explicit Manual casting needed
Character 2 bytes 'a', 'B' Higher → Lower
(Narrowing) e.g. int y=(int)x;
String – "hello", "BOSS"

Null – null Type Promotion in Mixed Expressions:


Result type = largest operand type.
e.g. float + double + int → double

⑦ Punctuators / Separators (9 in Java)


Symbol Name Purpose

() Parentheses Increase priority of operations; enclose method args

{} Braces Mark start/end of a block; initialise arrays

[] Brackets Specify array size / index

; Semicolon End of a statement (most common separator)

, Comma Separate variables in declaration

. Dot Access member functions / objects

ICSE Computer Applications – Class 9 | Chapter: Values and Data Types | Short Notes

You might also like