Showing posts with label Learn Java. Show all posts
Showing posts with label Learn Java. Show all posts

Sunday, December 25, 2011

operator in JAVA

An operator is a symbol that tell the computer to perform certain mathematical or logical manipulation.

Java operators are divided into eight categories: assignment, arithmetic, relational, logical, bitwise,
compound assignment, conditional, and type
.


 Assignment Operators         =
 Arithmetic Operators         -        +        *        /        %        ++        --
 Relational Operators         >        <        >=        <=        ==        !=
Logical Operators && || & | ! ^ Bit wise Operator & | ^ >> >>> Compound Assignment Operators += -= *= /= %=
         <<=        >>=     >>>=
 Conditional Operator         ?:
 
For more information visit programming-training.com 

Wednesday, December 21, 2011

Integer Constants in JAVA

An integer constant refers to a sequence of digits.Their are three types of integer

* Decimal Integer

Decimal integer consist of set of digit, 0 through 9. Example of decimal integer constants are: 156          -321      0       45689

Note : Embeded spaces, commas, and non-digit character are not permited between digits.

# Octal Integers

An octal integer constant consist of any combination of any combination of digit from 0 through 7, with a leading 0.Example of octal integer are:038         0        0564        06891

* Hexadecimal integer

A sequence of digit preceeded by 0x or 0x is considered as hexadecimal integer.In that include alphabets A through F or a through f.Example of hexadecimal integer is0x2       0x9F       0xbcd        0x









Example of Java Constant 

class IntConstant
{
public static void main(string args[])
{
int i=10;
System.out.println("Integer Contant Values : " +i);
}
}


Output of a Programme

Integer Contant Values : 10

Wednesday, December 14, 2011

Primitive Data Types

The Java programming language is statically-typed, which means that all variables must first be declared before they can be used.

  • byte: The byte data type is an 8-bit signed two's complement integer. It has a minimum value of -128 and a maximum value of 127 (inclusive). The byte data type can be useful for saving memory in large arrays, where the memory savings actually matters. They can also be used in place of int where their limits help to clarify your code; the fact that a variable's range is limited can serve as a form of documentation.
  • short: The short data type is a 16-bit signed two's complement integer. It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive). As with byte, the same guidelines apply: you can use a short to save memory in large arrays, in situations where the memory savings actually matters.
  • int: The int data type is a 32-bit signed two's complement integer. It has a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647 (inclusive). For integral values, this data type is generally the default choice unless there is a reason (like the above) to choose something else. This data type will most likely be large enough for the numbers your program will use, but if you need a wider range of values, use long instead.
  • long: The long data type is a 64-bit signed two's complement integer. It has a minimum value of -9,223,372,036,854,775,808 and a maximum value of 9,223,372,036,854,775,807 (inclusive). Use this data type when you need a range of values wider than those provided by int.
  • float: The float data type is a single-precision 32-bit IEEE 754 floating point.
  • double: The double data type is a double-precision 64-bit IEEE 754 floating point.
  • boolean: The boolean data type has only two possible values: true and false. Use this data type for simple flags that track true/false conditions. This data type represents one bit of information, but its "size" isn't something that's precisely defined.
  • char: The char data type is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive).

    Variable in JAVA

Tuesday, December 13, 2011

Java Identifiers

In java there are several points to remember about identifiers. They are as follows:
  • All identifiers should begin with a letter (A to Z or a to z ), currency character ($) or an underscore (-).
  • After the first character identifiers can have any combination of characters.
  • A key word cannot be used as an identifier.
  • Most importantly identifiers are case sensitive.
  • Examples of legal identifiers:age, $salary, _value, __1_value
  • Examples of illegal identifiers : 123abc, -salary






Sunday, October 2, 2011

Simple Java programme

A Simple Java Programme
class SamplePro
{
public static void main(String args[])
{
System.out.println("Simple Java Example");
}
}

 In the above example class is keyword and the SamplePro is file name.

For more information about this example visit Learn java with example




Tuesday, September 7, 2010

Few essential tips before begin with java

Learning the Java platform is an exciting journey. There is so much you can do with Java technologie but one biggest problem is that what you want to do and where to start is the first problem you need to sort out. The journey of learning Java platform should be fun, clear, and exciting one.


Before learning you need to consider the following points first
  • Choosing the tool
For learning java their are various tools are available like


javac The compiler for the Java programming language.
java The launcher for Java applications. In this release, a single launcher is used both for development and deployment.

The old deployment launcher, jre , is no longer provided.
javadoc API documentation generator
apt Annotation processing tool.
appletviewer Run and debug applets without a web browser.
jar Create and manage Java Archive (JAR) files.
jdb The Java Debugger.
javah C header and stub generator. Used to write native methods.
javap Class file disassembler
extcheck Utility to detect Jar conflicts.

First of all you will decide which tool to start for learning java .This is depending upon what you currently know about the tool. After reading about the tools, you will find out resources to learn about the technologies, and the details of the Java programming language.
The tools express the relationships between objects and how to make those objects interact and do things. Yet, each tool has been designed with a certain audience in mind.
  • Java Standard Edition (Java SE)
For learning the any tool you need the Java Standard Edition (Java SE) .Once you installed the Java SE on your computer, you are ready to learn the various tools that you want to learn.


Many of you, yet, may know some programming like C and C++ , or another programming language, or maybe you don’t know nothing of the programming language but you want to learn the programming language.


Download JAVA SE


After installing the Java SE , you'll also need to learn the basics of the Java programming language. Your best resource for this is The Java Tutorial.


After reading this article your all basic doubts will be sort out.