Posts Tagged ‘Core Java’
Core Java Workshop at TGPCET
Posted on: March 26, 2013
- In: Workshop
- 3 Comments
Conducted a Workshop on Core Java at Tulsiramji Gaikwad Patil College of Engineering & Technology, Nagpur on 25 Mar. 2013 & 26 Mar. 2013. It was nice to provide Classroom Training & Workshop on Core Java to students of TGPCET.
Have a look at glimpse of workshop here :
Watch this as You Tube video:
HelloWorld – Core Java Tutorial
Posted on: January 10, 2012
Objective :
- How to write a simple Java program?
- How to write Hello in Java?
- How to write HelloWorld in Java?
- How to write & execute a simple Java program?
- How to write Java program using Notepad & execute using Command Prompt?
Posted from WordPress for Android
Data Types in Java
Posted on: October 17, 2011
In Java there are total 8 data types available which are further divided into 4 groups viz. integers, floating point numbers, character & boolean values.
|
Type |
Size in Bytes (Bits) |
Range |
Default value |
Contains |
| Integers | ||||
| Byte | 1 byte (8 bits) | -128 to 127 | 0 | Signed Integer |
| Short | 2 bytes
(16 bits) |
-32768 to 32767 | 0 | Signed Integer |
| Int | 4 bytes
(32 bits) |
-2147483648 to 2147483647 | 0 | Signed Integer |
| Long | 8 bytes
(64 bits) |
-9223372036854775808 to 9223372036854775807 | 0 | Signed Integer |
| Floating point numbers | ||||
| Float | 4 bytes
(32 bits) |
-3.4e38 to 3.4e38
(i.e. 3.4*1017) |
0.0 | IEEE754 Floating point number |
| Double | 8 bytes
(64 bits) |
-1.7e308 to 1.7e308
(i.e. 1.7*10151) |
0.0 | IEEE754 Floating point number |
| Characters | ||||
| char | 2 bytes
(16 bits) |
\u0000 to \uFFFF | \u0000 | Unicode Characters |
| Boolean values | ||||
| boolean | 1 bit | Not Applicable | False | true or false |
|
Table : Data Types in Java |
||||
How to set Path for Java
Posted on: August 24, 2011
- In: How to's | Java | Java Tutorials | Video Tutorials
- 12 Comments
Dear Friends,
If you want to set the path for Java, there are two main types for setting system path for Java which are as follows;
- Temporary Path
- Permanent Path
For the above two types, the video describes the complete step by step procedure for setting path for Java :
Or you can go through this tutorial :
f. But if the other message having length nearly equal to half a page then path is set.
3. Permanent Path :
Escape Sequences in Java
Posted on: June 12, 2011
Objectives :
- What are the escape sequences in Java?
- What are the escape characters in Java?
Generally we enter all the characters directly. The escape sequences are used for those characters which cannot be entered directly.
| Sequence | Purpose |
| \n | New Line (i.e. Line feed) |
| \b | Backspace |
| \t | Tab |
| \r | Carriage return |
| \f | Form Feed |
| \\ | Backslash |
| \’ | Single quote |
| \” | Double quote |
| \ddd | Octal Characters (i.e. ddd) |
| \uxxxx | Hexadecimal Unicode Characters (i.e. xxxx) |
|
Escape Sequences in Java |
|
Separators in Java
Posted on: May 25, 2011
Following are the some characters which are generally used as the separators in Java.
|
Separator |
Name |
Use |
|
. |
Period |
It is used to separate the package name from sub-package name & class name. It is also used to separate variable or method from its object or instance. |
|
, |
Comma |
It is used to separate the consecutive parameters in the method definition. It is also used to separate the consecutive variables of same type while declaration. |
|
; |
Semicolon |
It is used to terminate the statement in Java. |
|
() |
Parenthesis |
This holds the list of parameters in method definition. Also used in control statements & type casting. |
|
{} |
Braces |
This is used to define the block/scope of code, class, methods. |
|
[] |
Brackets |
It is used in array declaration. |
|
Separators in Java |
||
Operators in Java
Posted on: May 24, 2011
- In: Java | Java Tutorials
- 2 Comments
In Java we are provided with number of different operators & these operators are further divided into arithmetic, bitwise, relational and logical groups.
Arithmetic Operators
The arithmetic operators are used to perform the arithmetic operations in algebra.
| Operator | Operation |
| + | Addition |
| - | Subtraction |
| * | Multiplication |
| / | Division |
| % | Modulus |
| ++ | Increment |
| += | Addition assignment |
| -= | Subtraction assignment |
| *= | Multiplication assignment |
| /= | Division assignment |
| %= | Modulus assignment |
| – | Decrement |
|
Arithmetic Operators in Java |
|
Bitwise Operators
The bitwise operators are used to perform the different operations depending upon the individual operators.
| Operator | Operation |
| ~ | Bitwise Unary NOT |
| & | Bitwise AND |
| | | Bitwise OR |
| ^ | Bitwise Exclusive OR |
| >> | Shift Right with Sign Fill |
| >>> | Shift Right with Zero Fill |
| << | Shift Left |
| &= | Bitwise AND assignment |
| |= | Bitwise OR assignment |
| ^= | Bitwise Exclusive OR assignment |
| >>= | Shift Right assignment |
| >>>= | Shift Right Zero Fill assignment |
| <<= | Shift Left assignment |
|
Bitwise Operators in Java |
|
Relational Operators
The relational operators are used relate or to determine the relationship between the two operands.
|
Operator |
Operation |
| == | Equal to |
| != | Not equal to |
| > | Greater than |
| < | Less than |
| >= | Greater than equal to |
| <= | Less than equal to |
|
Relational Operators in Java |
|
Boolean Logical Operators
The boolean logical operators are used combine the two boolean operands resulting in new boolean value.
| Operator | Operation |
| & | Logical AND |
| | | Logical OR |
| ^ | Logical Exclusive OR |
| && | Short-circuit AND |
| || | Short-circuit OR |
| ! | Logical Unary NOT |
| &= | AND assignment |
| |= | OR assignment |
| ^= | Exclusive OR assignment |
| == | Equal to |
| != | Not equal to |
| ?: | Ternary If-Then-Else |
|
Boolean Logical Operators in Java |
|
The ? Operator
This is the special ternary operator in Java which is used to replace certain types of if-then-else statements.
Syntax :-
|
If expression1 results boolean value true then, expression2 is executed otherwise expression3 is executed.
Keywords in Java
Posted on: May 21, 2011
- In: Java | Java Tutorials
- 8 Comments
In Java there are total 49 keywords are available.
The keywords “const” & “goto” are reserved & not used.
The “true”, “false” & “null” are values.
One cannot use the keywords for any other purpose.
Following are the keywords in Java:
| abstract | assert | boolean | break | byte |
| case | catch | char | class | const |
| continue | default | do | double | else |
| extends | final | finally | float | for |
| goto | if | implements | import | instanceof |
| int | interface | long | native | new |
| package | private | protected | public | return |
| short | static | strictfp | super | switch |
| synchronized | this | throw | throws | transient |
| try | void | volatile | while | —— |
|
Keywords in Java |
||||
Features of Java
Posted on: May 20, 2011
- In: Java | Java Tutorials
- 28 Comments
Objective :-
- What are the features of Java?
- What are the key features of Java?
- Which features are supported by Java?
- What Object Oriented Features (OOPs features) of Java?
Following are the key features of the Java Programming Language :-
- Platform Independent
- Simple
- Object Oriented
- Robust
- Distributed
- Portable
- Secure
- Multithreaded
- Compiled & Interpreted
- Automatic Garbage Collection
- Built in Networking
- Dynamic Operations
- High Performance
- Free From
- Free Editor
- Case Sensitive
Platform Independent :
The concept of Java is “Write Once, Run Anywhere”. Here the term platform refers to the operating system, to run any java program we need JVM (Java Virtual Machine) and is not dependent on any of the tools & components provided by the operating system, therefore Java is platform independent.
Simple :
It is simple to understand i.e. user can write & update the code easily since many syntaxes are similar to C & C++, hence they are familiar too. Java also eliminates the several poor programming features of C & C++ like goto statements, header files, structures, operator overloading, multiple inheritance and pointers.
Object Oriented :
Java is based on the concepts on Object Oriented Programming Language such as Inheritance, Encapsulation, Polymorphism, Dynamic Binding, etc.
Robust :
The Java is strongly typed & allows the Java Compiler checks the program whether there any error and the Java Interpreter checks any run time error and makes the system secure from crash. These features make the java language robust.
Distributed :
Java supports different network connectivity such as HTTP, & FTP. They are also built in Java.
Portable :
The java language portable provided that the system must have interpreter for the JVM. Java also have the standard data size irrespective of operating system or the processor.
Secure :
Java does not use memory pointers explicitly. Programs run inside the virtual machine sandbox. Bytecode verification process in Java to ensure that the code loaded over the network does not violate Java security constraints such as;
- No memory pointers
- Array index limits
- Access restrictions, etc.
Multithreaded :
Java supports multithreading. Thread is nothing but the Lightweight process. When two or more than two threads runs concurrently, then they are said to be Multithreaded. Java also support synchronization of threads.
Compiled & Interpreted :
Java requires two steps to run a program;
- Compilation &
- Interpretation
The Java Compiler (javac) compiles the java code & produces the bytecode. The file generated after successful compilation containing the bytecode is known as Class file (“.class”) or Byte Code File.
The generated class file is then interpreted by the Java Interpreter (java) which gives the output.
Automatic Garbage Collection :
Java supports automatic memory management, it is done by JVM.
Built in Networking :
Java support networking as of it was designed keeping networking in mind & has many classes which help to create network & internet applications very easily.
Dynamic Operations :
Java supports various dynamic operations on demand such as;
- Linking of files from all over the world
- Loading of new classes & libraries
- Compilation of classes & libraries, etc.
High Performance :
Java uses native code & “just-in-time compiler” which converts the bytecode to machine code & since java is interpreted it gives high performance.
Free Form :
It is a free form language i.e. we can write multiple statements in a single line.
Free Editor :
It is free editor language i.e. we can edit Java programs in Notepad, Text pad, Dos editor, WordPad, VI editor, etc.
Case Sensitive :
Java is a case sensitive language i.e. it differs in small letters & capital letters.
All the above are the main features of the Java programming language.









