Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
College aantekeningen

Java Programming Module 1 Notes with OOP Concepts

Beoordeling
-
Verkocht
-
Pagina's
6
Geüpload op
18-05-2026
Geschreven in
2025/2026

These documents provide complete and well-structured notes on Java Programming, covering both fundamental and object-oriented concepts in detail. These notes are especially suitable for Computer Science and Engineering students learning Core Java and Object-Oriented Programming concepts.

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

Java Programming – Module 1
Core Concepts: Data Types, Variables, Control Statements & Arrays



1. Data Types in Java
Java is a statically-typed language, meaning all variables must be declared before use. A variable is a
reserved memory location to store a value. The data type of a variable determines the values it may
contain and the operations that may be performed on it.
Java data types are divided into two categories:
• Primitive Types – predefined by the language and named by reserved keywords.
• Non-Primitive (Reference) Types – such as arrays, classes, and interfaces.


1.1 Primitive Data Types
Java defines eight primitive types grouped into four categories:
• Integers: byte, short, int, long – for whole-valued signed numbers.
• Floating-point: float, double – for numbers with fractional precision.
• Character: char – represents symbols using Unicode (16-bit).
• Boolean: boolean – holds only true or false.

Default
Data Type Size Description
Value

boolean 1 bit false Logical true/false

char 2 bytes '\u0000' Unicode character

byte 1 byte 0 Signed 8-bit integer

short 2 bytes 0 Signed 16-bit integer

int 4 bytes 0 Signed 32-bit integer (most common)

long 8 bytes 0L Signed 64-bit integer

float 4 bytes 0.0f Single-precision 32-bit floating point

double 8 bytes 0.0d Double-precision 64-bit floating point


Integer Types – Details
• byte – Signed 8-bit type. Useful when working with streams of data from a network or file, or with raw
binary data. Range: –128 to 127. Example: byte b = 10;
• short – Signed 16-bit type. Useful to save memory in large arrays. Example: short s = 1000;
• int – Signed 32-bit type. The most commonly used integer type, used to control loops and index
arrays. Example: int a = 50000;
• long – Signed 64-bit type. Used when int is not large enough. Example: long a = 123456789L;


Floating-Point Types – Details
• float – Single-precision 32-bit. Useful when a fractional component is needed but high precision is not
critical. Example: float highTemp = 36.5f;

, • double – Double-precision 64-bit. Best choice when maintaining accuracy over many iterative
calculations or with large-valued numbers. Example: double pi = 3.14159;


Character and Boolean Types
• char – Java uses Unicode (16-bit) to represent characters. Example: char letterA = 'A';
• boolean – Can only hold true or false. This is the type returned by all relational operators. Example:
boolean b = true;


1.2 Wrapper Classes
Each primitive data type has a corresponding wrapper class in the java.lang package. These wrap
primitive types into objects, enabling them to be used in collections, generics, or anywhere objects are
required.

Primitive Wrapper Class

byte Byte

short Short

int Integer

long Long

float Float

double Double

char Character

boolean Boolean

Java 5 introduced auto-boxing (automatic conversion of a primitive to its wrapper) and auto-unboxing
(automatic conversion of a wrapper back to its primitive).


2. Variables
A variable is the basic unit of storage in a Java program. It is defined by a combination of an identifier, a
type, and an optional initializer. All variables have a scope (visibility) and a lifetime.

Example declarations:
int a, b, c;
int d = 3, e, f = 5;
byte z = 22;
double pi = 3.14159;
char x = 'x';


2.1 Naming Rules
• Variable names are case-sensitive.
• Allowed characters: letters [A–Z, a–z], digits [0–9], $ (dollar sign), and _ (underscore).
• Identifiers cannot start with a digit. Example: 123geeks is invalid.
• Reserved words (e.g., while, int) cannot be used as identifiers. Java has 53 reserved words.
• Special characters like @ are not allowed. Example: geek@ is invalid.

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
18 mei 2026
Aantal pagina's
6
Geschreven in
2025/2026
Type
College aantekeningen
Docent(en)
Mrs shyama
Bevat
Alle colleges

Onderwerpen

$3.49
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
azuz

Ook beschikbaar in voordeelbundel

Maak kennis met de verkoper

Seller avatar
azuz Rajagiri School of Engineering and Technology
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
-
Lid sinds
3 dagen
Aantal volgers
0
Documenten
6
Laatst verkocht
-

0.0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen