Quick introduction to Java Programming language - Part 1
Chapters
Data types in Java
Each and every variable in the Java must have a data type. The memory allocation to the variable is based on the data type.By assigning data types to variables, user can store integers, characters or decimalsin these variables.
Categories of data types in Java:
- Primitive Data Types
- Derived/Reference/Object Data Types
Primitive Data Type: is the basic type, which is inbuilt data type of java.
- Variables declared with primitive data type are known as primitive data type.
Primitive data types are:
Data Type |
Description |
Memory Size |
byte |
Byte-length integer |
8-bit two's complement |
short |
Short integer |
16-bit two's complement |
int |
Integer |
32-bit two's complement |
long |
Long integer |
64-bit two's complement |
float |
Single-precision floating point |
32-bit IEEE 754 |
double |
Double-precision floating point |
64-bit IEEE 754 |
char |
A single character |
16-bit Unicode character |
boolean |
A boolean value |
true or false |
Syntax: data-type variable name;
Example: int age;
Derived Data Types:
This is customized data type of java.
- Variables declared with deriveddata type are known as derived data type.
- Mainly used to store the reference/address of an object created,Class objects, and various type of array variables come under reference data type.
Example:
Creating object for Account class
Account a1 = new Account(“Savings”);
Here, a1
is derived data type.
Java supports few escape sequences. They are:
- \n: It is used to points the cursor to Newline
- \r: It is for carriage return
- \s: It is for space
- \\: backslash
- \t: tab
- \f: It is for formfeed
- \ddd: It is for octal character (ddd)
- \": It is used for double quote
- \': It is used for single quote
- \uxxx: It is for Hexadecimal UNICODE character (xxxx)
Description
This tutorial is targetted for beginers seeking a quick get on with guide on Java programming language. 3 parts include
- Java basics
- Object oriented programming
- Advance concepts
Each part is subdivided in multiple chapters.
Java basics has the following chapters
- Introduction
- Environment Setup
- Basic Syntax
- Objects and Classes
- Basic Data Types
- Variable Types
- Modifier Types
- Basic Operators
- Loops
- Decision Making
- Numbers Class
- Character and String Class
- Arrays
- Date and Time
- Regular Expression
- Methods
- Streams, Files and I/O
- Exceptions Handling
Thanks for reading and as always, your feedback is very important to us. Let us know how we can improve and if you found any issues with this write up, send us a correction.
Audience
Beginners or students seeking a refresher on Java language
Author: Subject Coach
Added on: 9th Mar 2015
You must be logged in as Student to ask a Question.
None just yet!