Posts Tagged ‘Java tutorial for beginners’
Get MAC Address using Java
Posted on: June 11, 2012
Objective :
* How to get the MAC Address of a computer?
* How to get the MAC Address of a computer using Java?
* How to get the MAC Address of a computer via programming?
import java.net.*;
class GetMac
{
public static void main(String arg[])
{
try
{
InetAddress address = InetAddress.getLocalHost();
NetworkInterface nwi = NetworkInterface.getByInetAddress(address);
byte mac[] = nwi.getHardwareAddress();
System.out.println(mac);
}
catch(Exception e)
{
System.out.println(e);
}
}
}
Note : This code will return only the first net address; if you need other detils too, get a list.
Posted from WordPress for Android
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
Ws of Java
Posted on: December 12, 2011
Architecture of Java Program
Posted on: November 25, 2011
Objective :
- What is architecture of Java program?
While writing a java program, the above architecture need to be followed.
As the figure describes, documentation part or writing comments into program is completely optional. If you want to know, how to write comments & documentation in java? Click here
If the programmer wants to keep class in some package then only he/she will declare the package.
If we need to link any other class from some package then, we will write import statement otherwise if the classes are in same package there is no need of import statement.
Whereas class definition & program body is compulsory which will have your actual code.
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 :











