Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
Java All : Data Types Variables and Constants
Concept Notes and Resources
Concept Learning Code Sheets

Variable Declaration and Initialisation #3862

Variable declaration and initialisation varieties are explained here.

Understanding double and float data type #3840

Double and float data type declaration its max value and sizing.

Understanding byte, short, int and long types #3846

Different types of integer data types with its maximum and minimum value limits are explained with this code.

Understanding char data type #3848

The java char data type and its possible values are explained here.

Understanding boolean data type #3850

The java boolean data type declaration and its features.

Understanding Reference data type #3859

Reference data type for class object reference and array reference.

Variable Kinds – Local, Class and Instance Variables #3865

Mainly used kinds Local, Class and Instance Variables are discussed here.

Variable Default Values #3867

Java class variables have default values. Let us experiment with that.

Resolving Class and Local Variable Name Clash #3871

Methods to rightly use variable names when their names clash between class/static types and local types.

Variable Scope #575

This is a program that will tell you about the scope of variables in different parts of programs.

Getting size of Primitive data types #565

Outputs the size of the eight primitive data types present in java.

Sum and Difference of two numbers #569

Gives you understanding of declaration along with dynamic initialization

Product and Division of two numbers #571

Product and Division to show data type compatibility difference.

Average of two double numbers #573

Finding average of two double numbers.

Printing Ascii Codes as Characters Alphabets & Digits #3512

Printing uppercase alphabets, lowercase alphabets, digits by printing them as characters typecasted from its integer form ascii values.

Exam Paper Problems

Identifying Composite Data Types #3887

( As In Exam - ICSE2014 )

List the variables from those given below that are composite data types.

List the variables from those given below that are composite data types.
(i) static int x;
(ii) arr[i] = 10;
(iii) obj.display();
(iv) boolean b;
(v) private char chr;
(vi) String str;

Identifying Data Types #3901

( As In Exam - ICSE2014 )

Name the primitive data type in Java that is:
(i) a 64-bit integer and

Name the primitive data type in Java that is:
(i) a 64-bit integer and is used when you need a range of values wider than those provided by int.
(ii) a single 16-bit Unicode character whose default value is ‘u0000′

Default Values #3926

( As In Exam - ICSE2015 )

What are the default values of the primitive datatypes int and float?

What are the default values of the primitive datatypes int and float?

Primitive Data Type Sizes #3962

( As In Exam - ICSE2015 )

Arrange the following primitive data types in an ascending order of their siz

Arrange the following primitive data types in an ascending order of their size:
(i) char (ii) byte (iii) double (iv) int

primititve non-primitive identification #4032

( As In Exam - ICSE2018 )

Classify the following as primative or non-primative datatypes:
(i) cha

Classify the following as primative or non-primative datatypes:
(i) char
(ii) arrays
(iii)int
(iv) classes

ascii value of character #4035

( As In Exam - ICSE2018 )

(1) int res = ‘A’;
What is the value of res?

(ii) Na

(1) int res = ‘A’;
What is the value of res?

(ii) Name the package that contains wrapper classes.

data type size #4102

( As In Exam - ICSE2017 )

State the number of bytes occupied by char and int data types.

State the number of bytes occupied by char and int data types.

casting types identification #4223

( As In Exam - ICSE2016 )

What are the types of casting shown by the following examples:
(i) char

What are the types of casting shown by the following examples:
(i) char c = (char)120;
(ii) int x = ‘t’;

primitive versus composite data types #4250

( As In Exam - ICSE2016 )

Write one difference between primitive data types and composite data types.

Write one difference between primitive data types and composite data types.

Output Writing – Implicit conversion #7229

( As In Exam - ICSE2017 )

Write the output:
char ch = ‘F’;
int m = ch;
m=

Write the output:
char ch = ‘F’;
int m = ch;
m=m+5;
System.out.println(m + ” ” + ch);

Solved Problems

Output writing based on summation of different data types. #3852

Write output of the following program which is based on summation of differen

Write output of the following program which is based on summation of different data types.

class SP_DataSum
{
  public static void main(String[] args)
  {
    int n=12;
    double d=12.0;
    float f=12.0f;
    byte b=12;
    char c=12;
    System.out.println(n+d+f+b+c);
  }
}

 

Output writing for Data Type Size #3857

Find output of following data type size determination instructions using wrap

Find output of following data type size determination instructions using wrapper class declarations.

Integer n=12;
Double d=12.0;
Float f=12.0f;
Character c=12;
Short s=12;
Long l=12L;
Byte b=12;
System.out.println(n.SIZE);
System.out.println(d.SIZE);
System.out.println(f.SIZE);
System.out.println(c.SIZE);
System.out.println(s.SIZE);
System.out.println(l.SIZE);
System.out.println(b.SIZE);

Data type selection #3873

Write a program to initialise a variable with price of an item as a fractiona

Write a program to initialise a variable with price of an item as a fractional value. Then prepare another variable to output the price multiplied with 100 so that its lowest currency denomination (LCD) value is achieved. Print the LCD price with a suitable message. Choose appropriate variable names and data types.

Data default values Viva-question #3875

Why do we need to initialise local variables when we have default values spec

Why do we need to initialise local variables when we have default values specified for all primitive data types.

Float f suffix Viva-question #3880

Why do we add f suffix to a decimal literal number when we initialise a float

Why do we add f suffix to a decimal literal number when we initialise a float variable.

Quizzes

Concept Notes:1  Code Sheets:15  Exam Paper Problems:10  Solved Problems:5  Quizzes:7
Back