Showing posts with label cplusplus. Show all posts
Showing posts with label cplusplus. Show all posts

Saturday, 17 August 2013

Primitive Data types

data type informs the compiler what type of data a variable is permitted to store. Data type should also be declared when a variable s declared.

Declaring a data type:     datatypename  variablename

 Java as Java is a strongly typed language The data type indicates what type of values that variable can store and possible operations that can be performed. The language system allocates memory to the variable on the type of data it can hold like an integer or double etc. 
String in Java is not a data type. String is a class from java.lang package. String is not a keyword; Strings are used very often in coding like data types.
Java supports 8 data types that can be divided into 4 broad categories.
All data types are keywords. As a rule, all keywords should be written in lowercase. Java does not support unsigned data types; every data type is implicitly signed (except char). "unsigned" is not a keyword of Java. Note that nulltrue and false are also not keywords.



  • Whole numbers – byteshortintlong
  • Floating-point numbers – floatdouble
  • Character values – char
  • Boolean values – boolean
























  • Thursday, 16 May 2013

    Traversing an Array

    Traversing an array means to access each and very element of array .It can be accessed using for loops.The data stored in array can be travesred by using for loop and the elements can be accessed by incerement the for loop. The loop starts to traverse array from the start of the array and continue to traverse array until the for lopp continues its execution until the for loop ends.UIn the program below the elements are stored in an array and are travesred using for loop . The loop prints all the elements of array using traversing.
     

    Program for traversing an array.

    #include<iostream.h>
    #include<conio.h>
    void main()
    {
    int data[5]={1,2,3,4,5};
    int i;
    clrscr();
    cout<<""Elements of array Data are";
    for(i=0;i<=4;i++)
    {
    cout<<data[i];
    }
    getch();
    }

     

    full details in json
    Proudly Powered by Blogger.
    back to top