Re: Error?
- From: "A. W. Dunstan" <no@xxxxxxxxxxx>
- Date: Mon, 25 Sep 2006 10:23:26 -0400
Drop the "String" - you want "Name", not "String Name". A cut & paste
error, maybe?
gradebook2.setCourseName ( String Name ); // set the course name
Tukewl4u wrote:
Can some one tell me why I'm getting this error? I really don't understand
why it shouldn't work.
Executing: C:\Program Files\ConTEXT\ConExec.exe "C:\Program
Files\Java\jdk1.5.0_07\bin\javac.exe" "GradeBookTest.java"
GradeBookTest.java:30: ')' expected
gradebook2.setCourseName ( String Name ); // set the course name
^
1 error
Execution finished.
From the following:
import java.util.Scanner;
public class GradeBookTest
{
// main method begins program execution
public static void main ( String args[] )
{
// create GradeBook object
GradeBook gradebook1 = new GradeBook( "CSCI 3134 Introduction to Java
Programming" );
GradeBook gradebook2 = new GradeBook( "Joe Schmo" );
// display initial value of courseName for each GradeBook
System.out.printf( "GradeBook for course name is: %s\n",
gradebook1.getCourseName() );
System.out.printf( "This course is presented by: %s\n",
gradebook2.getCourseName() );
// prompt for and read course name
System.out.println( "Please enter the course name:" );
String Name = input.nextLine(); // read a line of text
gradebook2.setCourseName ( String Name ); // set the course name
System.out.println(); // outputs a blank line
// display welcome message after specifying course name
GradeBook.displayMessage();
} //end main
} // end class GradeBookTest
--
Al Dunstan, Software Engineer
OptiMetrics, Inc.
3115 Professional Drive
Ann Arbor, MI 48104-5131
.
- References:
- Error?
- From: Tukewl4u
- Error?
- Prev by Date: Re: Scanner class and last line in a file
- Next by Date: Re: Scanner class and last line in a file
- Previous by thread: Error?
- Index(es):
Relevant Pages
|
|