The Artima Developer Community
Sponsored Link

Java Answers Forum
illegal start of type

7 replies on 1 page. Most recent reply: Apr 3, 2009 6:11 PM by Joe Parks

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 7 replies on 1 page
Kyle Panek

Posts: 1
Nickname: kylepanek
Registered: Sep, 2008

illegal start of type Posted: Sep 6, 2008 10:21 PM
Reply to this message Reply
Advertisement
illegal start of type
public class raEvent implements ItemListener,{
^
Here is my code:

import javax.swing.*;
import java.awt.event.*;

public class raEvent implements ItemListener, {

raNumber gui;

public raEvent(raNumber in) {
gui = in;
}

public void actionPerformed(ActionEvent event) {
String command = event.getActionCommand();
if (command == "Clear") {
clearAllFields();
}
}

void clearAllFields() {
gui.raNum.setText(null);
gui.billTo.setText(null);
gui.shipTo.setText(null);
gui.schoolName.setText(null);
gui.serialNumber.setText(null);
gui.badPartNumber.setText(null);
gui.badDescription.setText(null);
gui.goodPartNumber.setText(null);
gui.goodDescription.setText(null);
}
}

Please HELP!


Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: illegal start of type Posted: Sep 8, 2008 1:21 AM
Reply to this message Reply
Rogue comma.

Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: illegal start of type Posted: Sep 8, 2008 11:25 PM
Reply to this message Reply
> Rogue comma.

Good eyes there Vincent, I honestly would have never picked that up, even with the little IDE symbol pointing out which line it is - lesson learnt on my part: when the IDE shows you the faulty line, examine every character.

Though it would help if Kyle actually formatted his code.

Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: illegal start of type Posted: Sep 9, 2008 12:43 AM
Reply to this message Reply
I think that everyone has experienced that situation where you pore over code for ages, looking for that elusive error, only to have someone else walk up and point straight at it before they've even had time to read the code. Frustrating or what!

Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: illegal start of type Posted: Sep 18, 2008 2:28 PM
Reply to this message Reply
Many times the problem is in the line or lines previous to the line with the error meesage.

francis lapidario

Posts: 2
Nickname: murat098
Registered: Mar, 2009

illegal start of type===pls help me Posted: Mar 14, 2009 4:55 AM
Reply to this message Reply
y does this error occur?? HELP!!
huhuhu

import java.io.*;
public class Search{
public static void main(String[] args);
BufferedReader dataIn=new BufferedReader(new InputStreamReader(System.in));
String name=" ";
String add=" ";
int ctr = 0;

do{
try{
System.out.println("Please enter your friend's name: ");
name=dataIn.readLine();
System.out.println("You have entered "+name);
System.out.println("Please enter "+name"'s address: ");
add=dataIn.readLine();
System.out.println(name+" lives in "+add);
}
catch(IOException e){
System.out.print("Error")
}
}while(!ctr=(999));
}

francis lapidario

Posts: 2
Nickname: murat098
Registered: Mar, 2009

illegal start of type===pls help me Posted: Mar 14, 2009 5:18 AM
Reply to this message Reply
PLS HELP ME!!!

import java.io.*;
public class Search{
public static void main(String[] args);
BufferedReader dataIn=new BufferedReader(new InputStreamReader(System.in));
String name=" ";
String add=" ";
int ctr = 0;

do{
try{
System.out.println("Please enter your friend's name: ");
name=dataIn.readLine();
System.out.println("You have entered "+name);
System.out.println("Please enter "+name"'s address: ");
add=dataIn.readLine();
System.out.println(name+" lives in "+add);
}
catch(IOException e){
System.out.print("Error")
}
}while(!ctr.equals(999));
}

Joe Parks

Posts: 107
Nickname: joeparks
Registered: Aug, 2003

Re: illegal start of type===pls help me Posted: Apr 3, 2009 6:11 PM
Reply to this message Reply
There should be a brace rather than a semicolon at the end of the main declaration:

public static void main(String [] args) {

Flat View: This topic has 7 replies on 1 page
Topic: very important and urgent plz help Linked Structure using the java language Previous Topic   Next Topic Topic: xpathfunctionresolver

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use