1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Java Assistance T_T

Discussion in 'Software Development' started by tenshijinn, Aug 26, 2007.

Thread Status:
Not open for further replies.
  1. tenshijinn

    tenshijinn Thread Starter

    Sep 23, 2006

    I've been working on a java project for University coursework (due on Tuesday :S), I'm now rushing to complete it, its a todo list which I believe is currently within my ability to do.
    However I'm receiving random errors which is seriously delaying me probably due to my lack of experience, I was wondering if I can get some pro assistance.

    As of now I'm receiving an illegal start of expression message, I read around as much as I could and it seems to me it mostly involves the misplacement of brackets or methods opened within methods and etc, I really can't seem to place my error.
    Can anyone give me another opinion please, my deepest gratitude.

    - Busy Student

    My Code:

    import javax.swing.*;
    import java.util.*;
    import java.io.*;

    public class list{

    public static void main(String[]args){

    Todo r = new Todo();

    r.todo1 = JOptionPane.showInputDialog("Enter Subject");
    r.todo2 = Integer.parseInt(JOptionPane.showInputDialog("Enter Priority Number '1 - 5' 1 being most important and 5 least"));
    r.todo3 = JOptionPane.showInputDialog("Enter Due Date");

    public class Todo

    public String todo1;
    public int todo2;
    public String todo3;

    public Todo(String t1, int t2, String t3)

    todo1 = t1;
    todo2 = t2;
    todo3 = t3;

    } // 2do close

    } // main method close ---------------------------------------------------------------

    } // Class list closed
  2. Chicon


    Jul 29, 2004
    Hi tenshijinn,

    Welcome to TSG ! :)

    As the class Todo is declared inside a method (Todo is a local inner class), the modifier public is not required
    and the closing } of Todo must be followed by a ;
    Also, the declaration of Todo must be made before the statement Todo r = new Todo();.

  3. tenshijinn

    tenshijinn Thread Starter

    Sep 23, 2006
    Thankyou for the welcome, and thankyou so much for the help you're a godsent ^^
    I'll probably be around until I graduate in about 2 years lol.

    The class works perfectly thankyou very much, I'm still working on my todo method atm, hopefully I meet today's deadline :eek:
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/615733