Professional Documents
Culture Documents
Contents
Identifier Definition
What is identifier?
The name given by the
constant/variable, function, or class.
programmer
to
2. Integer Types
a.
b.
c.
d.
byte
short
int
long*
3. Floating Point
a. float* 1.401298 x 10-45 to 3.402823 x 1038 (32 bit)
b. double 4.940656 x 10-324 to 1.797693 x 10308 (64 bit)
Copyright 2013 Accenture All Rights Reserved.
Contd.
4. Char Data Type
a. char
Examples:
import java.io.*;
public class JavaDataTypes {
public static void main(String[] args) throws Exception {
byte b1 = 100; // byte
System.out.println(Variable b1: +b1);
short s1 = 1500; // short
System.out.println(Variable s1: +s1);
float f = 10.4f; // float
System.out.println(Variable f: +f);
double d = 1232.44; // double
System.out.println(Variable d: +d);
char ch1 = a; // character
char ch2 = 65; // ASCII code for A
System.out.println(Value of ch1: +ch1);
System.out.println(Value of ch2: +ch2);
}
}
Copyright 2013 Accenture All Rights Reserved.
10
Examples:
(Contd.)
import java.io.*;
import java.util.Scanner;
public class JavaDataTypes {
public static void main(String[] args) {
Scanner abc = new Scanner(System.in);
System.out.println(abc.nextLine());
}
}
11
Examples:
(Contd.)
import java.io.*;
import java.util.Scanner;
public class JavaDataTypes {
public static void main(String[] args) {
Scanner abc = new Scanner(System.in);
double fnum, snum, answer;
System.out.println(Enter first number: );
fnum = abc.nextDouble();
System.out.println(Enter second number: );
snum = abc.nextDouble();
answer = fnum + snum;
System.out.println(answer);
}
}
Copyright 2013 Accenture All Rights Reserved.
12
Keywords Definition
What is keyword?
reserved words used by a programming language.
13
Keywords Table
abstract
do
implement
private
throw
boolean
double
import
protected
throws
break
else
instanceof
public
transient
byte
extends
int
return
true
case
false
interface
short
try
catch
final
long
static
void
char
finally
native
super
volatile
class
float
new
switch
while
continue
for
null
synchronized
this
default
if
package
14
21
22