Archive for the ‘Java Source Code’ Category
Hello World in different languages
Posted on: July 6, 2012
- In: C Language Source Code | C Language Tutorials | COBOL Source Code | COBOL Tutorials | CPP Source Code | CPP Tutorials | CSS Code | CSS Tutorials | How to's | HTML Code | HTML Tutorials | Java Source Code | Java Tutorials | JavaScript Tutorials | PHP Source Code | PHP Tutorials | Web Design Tutorials
- 4 Comments
Objectives :
* How to write Hello World in Java?
* How to write Hello World in C?
* How to write Hello World in PHP?
* How to write Hello World in C++?
* How to write Hello World in JavaScript?
* How to write Hello World in HTML?
* How to write Hello World in CSS?
* How to write Hello World in COBOL?
Java
class HelloWorld
{
public static void main(String args[])
{
System.out.println(“Hello World!”);
}
}
C
#include
#include
void main()
{
clrscr();
printf(“Hello World!”);
getch();
}
C++
#include
#include
void main()
{
clrscr();
cout<getch();
}
CSS
body:before
{
content: “Hello World”;
}
COBOL
**************************** IDENTIFICATION DIVISION. PROGRAM-ID. HELLO ENVIRONMENT DIVISION. DATA DIVISION. PROCEDURE DIVISION. MAIN SECTION. DISPLAY “Hello World!” STOP RUN ****************************
HTML
<html> <head> <title>Hello World Example</title> </head> <body> Hello World! </body> </html>
JavaScript
document.write("Hello World");
PHP
<!--?php echo ‘Hello World!’ ?-->
Linux Shell Script
echo "Hello World !"
Enjoy coding!
Posted from WordPress for Android
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
Find your IP Address
Posted on: October 2, 2010
- In: Java | Java Source Code | Java Tutorials
- 2 Comments
Objective :
- How to find IP address of your computer?
- How to find IP address by programming?
- How to find IP address by Java programming?
- Write a Java program to find IP Address.
Hello guys.
Do you want to find your IP Address?
There are following ways to check / find your IP Address
- Using Command prompt.
- Using Programming.
package com.si.java.utility.ip;
import java.net.InetAddress;
/**
*
* Language : Java
* File : IPAddressFinder.java
* Date : Saturday, October 2, 2010
* @author Atul Palandurkar
* Email : atul.palandurkar@gmail.com
* Website : www.shardainfotech.com
*
*/
public class IPAddressFinder
{
public static void main(String[] args)
{
try
{
InetAddress ia = InetAddress.getLocalHost();
String ip = ia.getHostAddress();
System.out.println("Your IP Address :- "+ip);
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}




Writing Comments in Java
Posted by: Atul Palandurkar on: June 17, 2011
Objective :
Writing Comments in Java :
Single Line Comment :
This comment is used whenever we need to write anything in single line.
Syntax :
//<write comment here>
Example :
Multi Line Comment :
This type of comments are used whenever we want to write detailed notes (i.e. more than one line or in multiple lines)related to source code.
Syntax :
/*
<write comment here>
*/
Example :
Documentation Comment :
Syntax :
/**
*<write comment/description here>
*@author <write author name>
*@version <write version here>
*@param <write parameter here>
*@return <write return type here>
*/
Example :
Rate this:
Share this:
Like this: