Leave a Message To Me

This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Friday, May 28, 2010

Read from, and Write to, files in Java

import java.io.*;

public class test {
   public static void main (String [] args){
// Stream to write file
FileOutputStream fout;
   // Stream to read file
FileInputStream fin;
try
{
   // Open an output stream
   fout = new FileOutputStreama ("myfile.txt");

   // Print a line of text
   new PrintStream(fout).println ("hello world!");
                     // then read from the file
   fin = new FileInputStream ("myfile.txt");
   System.out.println( new DataInputStream(fin).readLine() );
}
// Catches any error conditions
catch (IOException e)
{
System.err.println ("Unable to write/read to file");
System.exit(-1);
}  

  }
}

Java Programming : static calling non-static



public class staticClass {
public static int fac(int n){
if (n <= 0)
return 1;
else
return n * fac(n -1);
}
public static void main (String [] args){
System.out.println("Factorial Valu : "+fac(3));
}
}
-----------------------------------------------
public class NonStatic {
public int fac(int n){  
if (n <= 0)
return 1;  
else  
return n * fac(n -1);  
}  
public static void main (String [] args){ 
NonStatic val = new NonStatic (); // create an object to class NonStatic to call the non static method  
System.out.println("Factorial Valu : "+val.fac(3));  
}  
}






Thursday, May 20, 2010

The Power Of Paint

I was surfing the net and I came across this interesting quote by Roman philosopher Plautus: “A woman without paint is like food without salt”. Actually it is kind true.

I am without a doubt against relating beauty to looks alone, but I do believe in the power of makeup, and have to admit that makeup -”paint”- does work its magic on making a very average woman looks like a hot movie star.

Most of us ,men, are attracted to “painted” women, we don’t care what’s underneath all those layers of colors, as long as she looks “hot”. We love it this way.

And that’s why I said that Plautus got it right, I find this quote really interesting, mind-provoking, and funny in a way.

Will you eat it