Login


Lost your password?

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


Shop
Java : Showcase: All Recent Posts Grouped
Concept Learning Code Sheets View all
Variable Scope #575  (16-Aug-2016)
In Topic(s) : Data Types Variables and Constants   

class VariableScope
{
static int n;
public static void main(String[] args)
{
n=15:
System.out.println("The square of the number is :"+(n*n));
}
}

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  (16-Aug-2016)
In Topic(s) : Data Types Variables and Constants    Data Types Variables and Constants    Beginning to Program   

class SizeOfPrimitives
{
public static void main (String[] args)
{
System.out.println("Size of char: " + (Character.SIZE) + " bit");
System.out.println("Size of byte: " + (Byte.SIZE) + " bit");
System.out.println("Size of short: " + (Short.SIZE) + " bit");
System.out.println("Size of int: " + (Integer.SIZE) + " bit ");
System.out.println("Size of long: " + (Long.SIZE) + " bit");
System.out.println("Size of float: " + (Float.SIZE) + " bit");
System.out.println("Size of double: " + (Double.SIZE) + " bit");
}
}

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


Hello World 2 #551  (16-Aug-2016)
In Topic(s) : Beginning to Program    Beginning to Program   

class HelloWorld2
{
public static void main(String[] args)
{
System.out.println("Hello "+"World!");
}
}

This is a program that prints hello world! given as two separate words.


Concept Notes and ResourcesView all



Back