import java.io.*;
public class inout{
public static void main (String[] args){
int a;
BufferedReader num= new BufferedReader(new InputStreamReader(System.in));
try
{System.out.println("Enter a number: ");
a = integer.parseInt(num.readLine());
System.out.println("THE NUMBER IS" + a);
}
catch(IOException e)
{System.out.println("ERROR");
{}}
import javax.swing.*;
public class jopt{
public static void main(String[]args){
int x;
x = Integer.parseInt(JOptionPane.showInputDialog("enter a number"));
JOptionPane.showMessageDialog(null, "the number is " + x, result", JOptionPane.INFORMATION_MESSAGE);
}}

Since you decided to just post the code and describe nothing about the problem, I will just point to the lines which *could* be holding the issues:-

Snippet1: Line 8

Snippet2: Line 6


Very helpful isn't it, so next time post a description of the problem you are facing.

Edited 6 Years Ago by stephen84s: n/a

what is your problem..

what exception or error you got..

post your run time or compile time error..

then we can help you..

otherwise we can't..we are not here to run and check your coding..

symbol : variable integer
location: class inout
a = integer.parseInt(num.readLine());
^
1 error

Process completed.

change that line like below

Integer.parseInt(num.readLine());

instead of

integer.parseInt

Edited 6 Years Ago by musthafa.aj: n/a

D:\My Documents\ComSys\inout.java:9: ';' expected
System.out.println("THE NUMBER IS" + a);
^
D:\My Documents\ComSys\inout.java:13: '}' expected
}}
^
2 errors


java.lang.NoClassDefFoundError: inout
Exception in thread "main"
Process completed.

Need to see all the code around lines 9 and 13. There is a syntax error before them that is giving the compile problems.

import java.io.*
public class ass2{
	public static void main (String args[]){
		BufferedReader myln = new BufferedReader (new InputStreamReader(System.ini));
		int grossPay,netPay,sss = 266,pagIbig = 200,philHealth = 300,hrsWorked,rate = 200,hrsLate;
		String myName = "", myStatus = "";
		try{
			System.out.print("Enter Employee Name: ");
			myName = myln.readLine();
			System.out.print("Enter Civil Status: ");
			myStatus = myln.readLine ();
			System.out.print("Enter Hours Worked: ");
			hrsWorked = Integer.parseInt(num.readLine());
			System.out.print("Enter Hours Late: ");
			hrsLate = Integer.parseInt(num.readLine());
			grossPay = (hrsWorked - hrsLate)*rate;
			netPay = grossPay - (sss + pagIbig + philHealth);
			System.out.println("Employee Name: " + myName);
			System.out.println("Civil Status: " + myStatus);
			System.out.println("Rate: " + rate);
			System.out.println("Hours Worked: " + hrsWorked);
			System.out.println("Hours Late: " + hrsLate);
			System.out.println("SSS premium: " + sss);
			System.out.println("Gross Pay: " + grossPay);
			System.out.println("Pag-Ibig: " + pagIbig);
			System.out.println("Phil Health: " + philHealth);
			System.out.println("Net Pay: " + netPay);
		}
		catch(IOException e){
			System.out.println("Error received");
		}
		}
	}

public class ass2{
^
1 error

Process completed.

-

java.lang.NoClassDefFoundError: ass2
Exception in thread "main"
Process completed.

This article has been dead for over six months. Start a new discussion instead.