Seminar Topics & Project Ideas On Computer Science Electronics Electrical Mechanical Engineering Civil MBA Medicine Nursing Science Physics Mathematics Chemistry ppt pdf doc presentation downloads and Abstract

Full Version: Overview of Classes, Methods, Variables and Data types ppt
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Overview of Classes, Methods, Variables and Data types

[attachment=48315]


Data Types

Java is a strongly typed language. This means that every variable must have a declared type.
There are eight primitive types in Java.
Four of them are integer types;
Two are floating-point number types;
One is the character type char, used for code units in the Unicode encoding scheme; and
One is a boolean type for truth values.
Data type specifies
Set of permissible values that can be assigned to a variable
Set permissible operations that can be applied on specified values

The char Type

The char type is used to describe individual characters. char x= 'A' is a character constant with value 65. It is different from "A", a string containing a single character.
Java uses Unicode character encoding. Unicode encoding units can be expressed as hexadecimal values that run from \u0000 to \uFF. For example, \u2122 is the trademark symbol (™)

Scope of variables

A variable's scope is the region of a program within which the variable can be referred to by its simple name.
Secondarily, scope also determines when the system creates and destroys memory for the variable.
The location of the variable declaration within your program establishes its scope and places it into one of these four categories:
member variable scope: class declaration
local variable scope: to the end of the block
method parameter (formal argument) scope: entire method
exception-handler parameter scope: catch block

Statements and Expressions, Literals

Expressions, Statements and Blocks
An expression is a series of variables, operators, and method calls (constructed according to the syntax of the language) that evaluates to a single value.
When writing compound expressions, you should be explicit and indicate with parentheses which operators should be evaluated first.
A statement forms a complete unit of execution and is terminated with a semicolon (Wink. There are three kinds of statements:
Expression statements – assignment expressions, increment/decrement ++/--, method calls, object creation expressions;
Declaration statements – statements that declare variable;
Control flow statements – regulates the order in which statements get executed. The for loop and the if statement are both examples of control flow statements.