Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2006

Tip: Looking for answers? Try searching our database.

Error?

Thread view: 
Tukewl4u - 24 Sep 2006 22:14 GMT
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
A. W. Dunstan - 25 Sep 2006 15:23 GMT
Drop the "String"  - you want "Name", not "String Name".  A cut & paste
error, maybe?

>       gradebook2.setCourseName ( String Name ); // set the course name

> Can some one tell me why I'm getting this error? I really don't understand
> why it shouldn't work.
[quoted text clipped - 42 lines]
>   } //end main
> } // end class GradeBookTest

Signature

Al Dunstan, Software Engineer
OptiMetrics, Inc.
3115 Professional Drive
Ann Arbor, MI  48104-5131

Vaxius - 09 Oct 2006 06:23 GMT
> Drop the "String"  - you want "Name", not "String Name".  A cut & paste
> error, maybe?
...
>>       String Name = input.nextLine(); // read a line of text
>>       gradebook2.setCourseName ( String Name ); // set the course name
...

In addition, I would recommend that you not capitalize the first letter of
variables, as it can sometimes get confusing.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.