All pastes #674396 Raw Edit

Anonymous

public java v1 · immutable
#674396 ·published 2007-08-29 06:15 UTC
rendered paste body
import javax.swing.*;public class SumOfNumbers {    public static void main(String[]args) {        String str = I("Enter a number yo (greater than 0)"); //using joptionpane.showinputdialog to get input        int number = Integer.parseInt(str); //making the string an int        while (number <= 0) {            D("DO0D WTF!");            str = I("Try that again retard");            number = Integer.parseInt(str);        }        //COMMENT FOR NO REASON!        int sum = 0;        for (int i = 1;i <= number;i++)            sum += i; //adding the sum                D("LOL the sum from 1 to "+number+" is "+sum);        System.exit(0);    }    //making my life easier    public static void D(String str){JOptionPane.showMessageDialog(null,str);}    public static String I(String str){return JOptionPane.showInputDialog(str);}}