If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > JAVA > Dos window keeps closing

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-06-07, 09:01
neoginn neoginn is offline
Registered User
 
Join Date: Oct 2006
Posts: 2
Dos window keeps closing

When I program even the smallest program and I run it in dos the damn thing keeps closing on me before I see my result. maybe its my coding... i am still a newbie to Java. here is my code:

/*
* Main.java
*
* Created on February 6, 2007, 8:45 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package additionapp.additionapp;

/**
*
* @author Administrator
*/
import java.util.Scanner;

public class Main {

/** Creates a new instance of Main */
public Main() {
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

int number1;
int number2;
int sum;

System.out.print("Enter First Interger: ");
number1 = input.nextInt();

System.out.print("Enter Second Interger: ");
number2 = input.nextInt();

sum = number1 + number2;

System.out.printf("Sum is %d\n", sum);

System.out.printf("Press Any Key to Exit");


}

}
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On