Wednesday, January 12, 2011
Monday, January 10, 2011
Sunday, December 5, 2010
Christamas List
Happy Christmas to all.. enjoy life
Labels:
christmas,
christmas list,
christmas song
Tuesday, November 30, 2010
Using File Stream and JOptionPane in java
import java.io.*;
import javax.swing.JOptionPane;
public class sample
{
public static void main(String args[])
{
try
{
PrintWriter pw=null;
String n1,n2;
String filename="C:\\jpcezar\\out.txt";
n1=JOptionPane.showInputDialog("Enter you Name:");
n2=JOptionPane.showInputDialog("Enter you Address:");
boolean apend=true;
if(apend)
{
pw=new PrintWriter(new FileWriter(filename,true));
}
else
{
pw=new PrintWriter(new FileWriter(filename,false));
}
pw.println("My Name is:" + n1);
pw.println("My Address is:" + n2);
JOptionPane.showMessageDialog(null,"Successfully save ");
pw.close();
pw.flush();
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"File not found"));
}
}
}
import javax.swing.JOptionPane;
public class sample
{
public static void main(String args[])
{
try
{
PrintWriter pw=null;
String n1,n2;
String filename="C:\\jpcezar\\out.txt";
n1=JOptionPane.showInputDialog("Enter you Name:");
n2=JOptionPane.showInputDialog("Enter you Address:");
boolean apend=true;
if(apend)
{
pw=new PrintWriter(new FileWriter(filename,true));
}
else
{
pw=new PrintWriter(new FileWriter(filename,false));
}
pw.println("My Name is:" + n1);
pw.println("My Address is:" + n2);
JOptionPane.showMessageDialog(null,"Successfully save ");
pw.close();
pw.flush();
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"File not found"));
}
}
}
Thursday, November 25, 2010
for DIT 11 Irregular
this is a sample program to compute two numbers and get the sum.
i hope you learn and enjoy....
import java.io.*;
import java.util.Scanner;
public class Computation
{
public static void main(String args[])
{
Scanner input=new Scanner(System.in);
int num1,num2,sum=0;
System.out.print("Enter first number:");
num1=input.nextInt();
System.out.print("Enter second number:");
num2=input.nextInt();
sum=num1 + num2;
System.out.println("The sum is:" + sum);
}
}
i hope you learn and enjoy....
import java.io.*;
import java.util.Scanner;
public class Computation
{
public static void main(String args[])
{
Scanner input=new Scanner(System.in);
int num1,num2,sum=0;
System.out.print("Enter first number:");
num1=input.nextInt();
System.out.print("Enter second number:");
num2=input.nextInt();
sum=num1 + num2;
System.out.println("The sum is:" + sum);
}
}
Tuesday, November 16, 2010
Subscribe to:
Posts (Atom)