Working no something for school and keep getting this.

\\filesvrcls\2011\stawil\Java\midterm2.java:37: illegal start of expression
public static int numsum(int a, int b)
^
\\filesvrcls\2011\stawil\Java\midterm2.java:60: class, interface, or enum expected
}
Process completed.

//***********************************************************
//    midterm2.java			Author: Will Stahl
//
//    demonstrates Keyboard class
//***********************************************************

public class midterm2
{
	public void main(String args[])
	{
		{
	
		//declare variables
		int a;
		int b;
		int c;

		//accept inputs
		System.out.print("Enter a positive integer: ");
		a = Keyboard.readInt();

		System.out.print("Enter a larger positive integer: ");
		b = Keyboard.readInt();	
			
		if(b<a)
		{System.out.print("Please enter a larger number then value:");
			break;
		}
			
		if(a || b < 0)
		{	System.out.print("Please enter a positive value!");
			break;
		}
		
		}
		
	public static int numsum(int a, int b)
		
	{	
		//declare variables
	  	int ans=1;
	  	int a=c;
 
	  		
	  	//accept inputs
	  	while(true)
	 	{
	 	if(c==b-a+1)
	  		break;
		  	ans=c*ans;
			c++;
	  	}
	  		
	  	//return
	  	return ans;
  	
	}
  	
	}
}

You have a double opening brace '{' for your main method (which is the reason that it is indented so far). Fix that. Then remove one of the "closing" braces '}'

Thanks for the help. I did my best to fix the brackets but now i get a bunch of errors i wasnt getting before. ANY help is great.

//***********************************************************
//    midterm2.java			Author: Will Stahl
//
//    demonstrates Keyboard class
//***********************************************************

public class midterm2
{
	public void main(String args[])
	{
		
 	   //declare variables
		int a;
		int b;
		int c;

		//accept inputs
		System.out.print("Enter a positive integer: ");
		a = Keyboard.readInt();

		System.out.print("Enter a larger positive integer: ");
		b = Keyboard.readInt();	
			
		if(b<a)
		{System.out.print("Please enter a larger number then value:");
			break;
		}
			
		if(a || b < 0)
		{	System.out.print("Please enter a positive value!");
			break;
		}
		
	}
	public static int numsum(int a, int b)
		
	{	
		//declare variables
	  	int ans=1;
	  	int a=c;
		int c;
 
	  		
	  	//accept inputs
	  	while(true)
	 	{
	 	if(c==b-a+1)
	  		break;
		  	ans=c*ans;
			c++;
	  	}
	  		
	  	//return
	  	return ans;
  	
	}
  	
}

New errors:
--------------------Configuration: <Default>--------------------
\\filesvrcls\2011\stawil\Java\midterm2.java:19: cannot find symbol
symbol : variable Keyboard
location: class midterm2
a = Keyboard.readInt();
^
\\filesvrcls\2011\stawil\Java\midterm2.java:22: cannot find symbol
symbol : variable Keyboard
location: class midterm2
b = Keyboard.readInt();
^
\\filesvrcls\2011\stawil\Java\midterm2.java:26: break outside switch or loop
break;
^
\\filesvrcls\2011\stawil\Java\midterm2.java:29: operator || cannot be applied to int,boolean
if(a || b < 0)
^
\\filesvrcls\2011\stawil\Java\midterm2.java:31: break outside switch or loop
break;
^
\\filesvrcls\2011\stawil\Java\midterm2.java:40: a is already defined in numsum(int,int)
int a=c;
^
\\filesvrcls\2011\stawil\Java\midterm2.java:40: cannot find symbol
symbol : variable c
location: class midterm2
int a=c;
^
7 errors

Process completed.

Well, what do you think those errors are trying to tell you? They are not simply there for someone else to solve for you. Take the first one "Cannot find Symbol Keyboard" Well, what is Keyboard? What do you need to do so that the compiler recognises it?

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