Tuesday, 24 July 2012

Data Types? Java has it!



Java is not hard to learn if you have background about C and C++. They have similarities especially on data types and variables. For us to understand better the java programming language we prepare some report that can help us. The content of this report is all about data types, reserved words, keywords, naming convention, identifiers and operations of this programming language. So enjoy reading, and we hope that it can help you learn the java language.

36 comments:

  1. Java programming language is a language in which all the variables must be declared first and then to be used.
    Java programming language is a language in which all the variables must be declared first and then to be used. That means to specify the name and the type of the variable. This specifies that Java is a strongly-typed programming language.

    ReplyDelete
    Replies
    1. some of the features mentioned in the referenced document also seemed to
      have some amount of vague similarity to those in C#, ...

      Delete
    2. The Dark Side Of Java
      Metasploit adds new module for latest Java attack as Java becomes cybercriminals' new favorite target

      do read the whole arcticle http://www.darkreading.com/vulnerability-management/167901026/security/news/232200604/the-dark-side-of-java.html

      Delete
  2. yes they have similarities but still they have differences so learn and enjoy….. explore everything about java and be satisfied for the benefits that it can share.

    ReplyDelete
  3. guys, you can check this sites for more info's about java datatypes..

    http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

    http://www.roseindia.net/java/master-java/java-data-types.shtml

    ReplyDelete
  4. The keywords const and goto are reserved by Java, even though they are not currently used in Java. This may allow a Java compiler to produce better error messages if these C++ keywords incorrectly appear in Java programs.

    ReplyDelete
  5. Java's basic data types are almost identical to C/C++ data types. The main difference is that Java's types all have a set size regardless of platform, while C/C++'s data types only have a minimum number of bits, which causes some variation between platforms. It also has the same two categories; Integer and Floating Point.

    ReplyDelete
  6. Data type defines a set of permitted values on which the legal operations can be performed. Data type defines a set of permitted values on which the legal operations can be performed. In java, all the variables needs to be declared first i.e. before using a particular variable, it must be declared in the program for the memory allocation process.

    ReplyDelete
  7. Both C++ and Java support class (static) methods or functions that can be called without the requirement to instantiate an object of the class.

    ReplyDelete
  8. BOOLEAN
    This keyword is used to pertain to an expression or variable that can have only a true or false value.

    ReplyDelete
    Replies
    1. yeah, right jorrel, and example program for this is...


      // Demonstrate boolean values.
      class BoolTest {
      public static void main(String args[]) {
      boolean b;
      b = false;
      System.out.println("b is " + b);
      b = true;
      System.out.println("b is " + b);
      // a boolean value can control the if statement
      if(b) System.out.println("This is executed.");
      b = false;
      if(b) System.out.println("This is not executed.");
      // outcome of a relational operator is a boolean value
      System.out.println("10 > 9 is " + (10 > 9));
      }
      }

      The output generated by this program is shown here:

      b is false
      b is true
      This is executed.
      10 > 9 is true

      There are three interesting things to notice about this program. First, as you can see, when a boolean value is output by println( ), "true" or "false" is displayed. Second, the value of a boolean variable is sufficient, by itself, to control the if statement. There is no need to write an if statement like this:

      if(b == true) ...

      Third, the outcome of a relational operator, such as <, is a boolean value. This is why the expression 10 > 9 displays the value "true." Further, the extra set of parentheses around 10 > 9 is necessary because the + operator has a higher precedence than the >.

      Delete
  9. Organizing the data for processing is an essential step in the development of a computer program. Programming in Java is largely based on doing so with data types known as reference types that are designed to support object-oriented programming, a style of programming that facilitates organizing and processing data. The eight primitive data types (boolean, byte, char, double, float, int, long, and short) that you have been using are supplemented in Java by extensive libraries of reference types that are tailored for a large variety of applications. As examples, you will learn in this section how to use several reference types, for image processing and string processing applications. Some of them are built into Java (String and Color) and some were developed for this book (In, Out, and Picture).

    ReplyDelete
  10. After declaring a variable and once it has a value, to display that value, you can provide the name of the variable to the parentheses (in future lessons, we will learn that this is referred to as passing) of the System.out.print() method.

    ReplyDelete
  11. In addition...
    ...you can also assign values based on the result comparisons to Boolean variables. Java supports SIX relational operators that are used to make comparisons.
    A RELATIONAL OPERATOR compares two items; an expression that contains a relational operator has a Boolean value.
    <, >, ==, <=, >=, and != were only the relational operators that Java can support.

    ReplyDelete
  12. Java is considered a strongly typed programming language in that it is obligatory for all data, expressions and declarations within the code to have a certain type associated with it. This is either declared or inferred and the Java language only allows programs to run if they adhere to type constraints.

    ReplyDelete
  13. Reserved words are also used in operating systems as a method of identifying a device file or other service.

    ReplyDelete
  14. catch here about some java datatypes you will know the
    two types in java programming language .



    site:
    .^.java data types - Codemiles.com

    ReplyDelete
  15. There are two data types available in Java:

    1.

    Primitive Data Types
    2.

    Reference/Object Data Types

    http://www.tutorialspoint.com/java/java_basic_datatypes.htm

    ReplyDelete
  16. float
    The float data type is a single-precision 32-bit IEEE 754 floating point. It ranges from 1.40129846432481707e-45 to 3.40282346638528860e+38 (positive or negative). Use a float (instead of double) to save memory in large arrays. We do not use this data type for the exact values such as currency. For that we have to use java.math.BigDecimal class.

    ReplyDelete
  17. A data type is a set of values and a set of operations defined on those values. For example, the values of the primitive data type int are integers between -231 and 231 - 1; the operations of int are the basic arithmetic and logical operations that we have been using since Chapter 1. You have already been using a data type that is not primitive - the String data type. The values of String are sequences of characters; we have used only a few of the available operations on those values (such as concatenating two strings).

    ReplyDelete
  18. cathlyn mosuela25 July 2012 at 18:08

    Java Keywords and Reserved Words
    abstract assert boolean break byte case

    catch char class const continue default

    do double else enum extends false

    final finally float for goto if

    implements import instanceof int interface long

    native new null package private protected

    public return short static strictfp super

    switch synchronized this throw throws transient

    true try void volatile while

    ReplyDelete
  19. There are two kinds of Java data: simple data and objects. Simple java data are boolean, character, integer, and real values. Java objects are encapsulations of various kinds of data components, together with methods for manipulating the components and returning information about them. Methods are like C functions, although the syntax for their use is different.

    for more info check this site..
    http://www.d.umn.edu/~gshute/java/c2java.html

    ReplyDelete
  20. Data types in java are designed to support all forms of numbers and are capable of representing multiple languages which has very good support for Internationalization. avaj-

    ReplyDelete
  21. try neo pu iopen..
    http://softpixel.com/~cwright/programming/datatypes.java.php

    ReplyDelete
    Replies
    1. uh, it/s helpful bam..but check this out

      too...http://en.wikipedia.org/wiki/Comparison_of_Java_and_C%2B%2B

      :)

      Delete
  22. try to open po:

    http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

    ReplyDelete
  23. We should know what are these reserved and keywords so that we will know what are the words that we cannot use in declaring. We cannot use reserved words and keywords as a variable in declaring because these words are defined in Java language for a specific purposes.

    ReplyDelete
  24. BRYAN ESTOCAPIO26 July 2012 at 00:44

    Java is logical. For example you declare a variable and you don't give a value , its automatically 0. Not a big deal but its cool compare to c++ and c. When you perform arithmetic operations with operands of unlike types, java uses a unifying type for the result. The unifying type is the type to which all operands in an expression are converted so that they are compatible with each other. Java performs an implicit conversion; that is, automatically converts nonconforming operands to the unifying type.

    It is the order of establishing unifying values between values.
    1. double
    2. float
    3. long
    4. int

    ReplyDelete
  25. Data types in java are designed to support all forms of numbers and are capable of representing multiple languages which has very good support for Internationalization. avaj-

    ReplyDelete
  26. Guys, this link is really informative on java data types. It enlists the different data types including their corresponding size in bits, and in byte,as well as their values and the wrapper. For instance:

    Data Type : integer
    Size in Byte : 4bytes
    Size in Bits : 32bits
    Values: signed /unsigned integer
    Wrapper:java.lang.Integer

    link : http://www.codemiles.com/java/java-data-types-t3140.html

    ReplyDelete
  27. This comment has been removed by the author.

    ReplyDelete
  28. Data types in Java.
    There are eight data types built directly into the Java language, including int, double, and boolean. These map directly to hardware (registers in the CPU). Other data types, including String, are composed from these primitive types using a special construct in Java known as a class. A class is a blueprint that specifies which values and operations are permissible. In Java, we refer to these operations as methods. An object is an instance of a class, and represents one of the permissible values. Each object is associated with a class and is created from the class blueprint. It is possible to create many objects from the same blueprint, but each object stores its own value and is manipulated independently. For example, we might create several objects from the class String, each storing a different sequence of characters.

    ReplyDelete
  29. Why is each public class in a separate file? (Section 1)

    anyone?
    This is a question that I have frequently been asked during my courses. In section 1, we read: "Although each Oak compilation unit can contain multiple classes or interfaces, at most one class or interface per compilation unit can be public".

    In the sidebar it explains why: "This restriction is not yet enforced by the compiler, although it's necessary for efficient package importation"

    It's pretty obvious - like most things are once you know the design reasons - the compiler would have to make an additional pass through all the compilation units (.java files) to figure out what classes were where, and that would make the compilation even slower.

    ReplyDelete
  30. The dark side of Java

    http://my.safaribooksonline.com/book/programming/java/9781449382322/exceptions/the_dark_side

    ReplyDelete
  31. There are two data types of Java:

    1.Primitive Data Types
    2.Reference/Object Data Types
    http://javabeanz.wordpress.com/2007/07/09/data-types-in-java-a-different-approach/

    ReplyDelete
  32. Beginning an identifier with a lowercase letter and capitalizing subsequent words with in the identifier is a style known as Camel Casing. An Identifier such as lastName resembles a camel because of the upper case "Hump" in the middle.

    ReplyDelete