Showing posts with label PROGRAMING. Show all posts
Showing posts with label PROGRAMING. Show all posts

Tuesday, 23 April 2013

What is Difference Between Compiler and Interpreter

| |
0 comments
ADS :
- All stilts - jumping stilts allstilts.com
- Anything painted on canvas anythingpaintedoncanvas.com

A Compiler and Interpreter both carry out the same purpose – convert a high level language (like C, Java) instructions into the binary form which is understandable by computer hardware.

Specific compilers/interpreters are designed for different high level languages. However both compiler and interpreter have the same objective but they differ in the way they accomplish their task i.e. convert high level language into machine language. 

The main difference between Compiler and Interpreter :

  • The compiler executes the entire program at a time, but the interpreter executes each and every line individually.
  • The interpreter takes one statement then translates it and executes it and then takes another statement. While the compiler translates the entire program in one go and then executes it.
  • Compiler generates the error report after the translation of the entire page while an interpreter will stop the translation after it gets the first error.
  • In a compiler the analyzing and processing time of the program is more, while an interpreter spends less time for the program analyzing and processing.
  • Compiler translates the high level instruction into machine language, but the interpreter translates the high level instruction into an intermediate code.


Read More

Wednesday, 5 September 2012

How to Guess Birthday using Java Program

| |
0 comments

Run this program and find your Birthday in given table . If it is there push "YES" button , Otherwise "NO" and continue so on..... in the end, it will give your birthday.

import javax.swing.JOptionPane;


public class Birthday
{
 public static void main(String arg[])
 {
   String s1="1 3 5 7\n"+"9 11 13 15\n"+"17 19 21 23\n"+"25 27 29 31\n";
  
   String s2="2 3 6 7\n" + "10 11 14 15\n" + "18 19 22 23\n" + "26 27 30 31\n";
 
   String s3="4 5 6 7\n" + "12 13 14 15\n" + "20 21 22 23\n" + "28 29 30 21\n";
 
  String s4="8 9 10 11\n" + "12 13 14 15\n" + "24 25 26 27\n" + "28 29 30 31\n";
 
  String s5="16 17 18 19\n " + "20 21 22 23\n" + "24 25 26 27\n" + "28 29 30 31\n";

  int date=0;
  int ans=JOptionPane.showConfirmDialog(null,"1st Table \n \n IS your BIRTHDAY in these number? \n\n" + s1);
  if(ans==JOptionPane.YES_OPTION)
	date+=1;

  int ans1=JOptionPane.showConfirmDialog(null,"2nd Table \n\n IS your BIRTHDAY in these number? \n\n"+s2);
  if(ans1==JOptionPane.YES_OPTION)
	date+=2;
  
  int ans2=JOptionPane.showConfirmDialog(null,"3rd Table \n\n IS your BIRTHDAY in these number?\n\n"+s3);
  if(ans2==JOptionPane.YES_OPTION)
   date+=4;

  int ans3=JOptionPane.showConfirmDialog(null,"4th Table \n\n IS your BIRTHDAY in these number?\n\n"+s4);
  if(ans3==JOptionPane.YES_OPTION)
   date+=8;

  int ans4=JOptionPane.showConfirmDialog(null,"5th Table \n\n IS your BIRTHDAY in these number ?\n\n"+s5);
  if(ans4==JOptionPane.YES_OPTION)
   date+=16;
  
  JOptionPane.showMessageDialog(null,"Your Birthday is "+date +"!");
  
  JOptionPane.showMessageDialog(null,"Thank You\n\nIs prepared By Nikul Chaudhary ");
 }
}
You also download a this program.
      DOWNLOAD 






Ebay Ads:
Electronics, Cars, Fashion and More Online Shopping  
www.ebay.com | www.ebay.co.uk | ebay.de

Related Post :

Read More
Powered by Blogger.