Results 1 to 4 of 4
  1. #1
    Jon_New is offline Member
    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    Question First post Hello, and quick question (I hope)

    Hello everyone,

    I am new to java, and hoping to get better over the next few months.

    I am trying to write a simple program to do a measurement conversion and I am receiving this error "class, interface, or enum expected" i have listed the code below:


    importjava.io*;
    public class VoiceExample {
    public static void main(String[] args) {

    ConsoleReader console = new ConsoleReader(System.in);
    System.out.println("Please enter the time in Seconds.");
    double sec = console.readDouble ();

    final int KBYTE = 1024;
    final int VOICE_BYTES_PER_SECOND = 8000;
    final int VOICE_KB_PER_SECOND = VOICE_BYTES_PER_SECOND / KBYTE;
    double voiceKB= sec / VOICE_KB_PER_SECOND;

    System.out.println();
    }//end of main method
    }//emd of class VoiceExample

    Thanks for any help!

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: First post Hello, and quick question (I hope)

    Check your spelling, check your space between identifiers. A compiler is very persnickety about what it will accept.

  3. #3
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default Re: First post Hello, and quick question (I hope)

    There are typos in the import line. And ConsoleReader is not a standard Java class, so you'll need to import some 3rd party library for that.

    Read whatever documentation came with the problem you're working on. And with whereever you got it for typos or other misinformation. I mention this because exactly the same code is mentioned in the discussion here: Newb java problem

  4. #4
    Jon_New is offline Member
    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    Default Re: First post Hello, and quick question (I hope)

    Ahh, I see. Thanks!

Similar Threads

  1. Quick question.
    By juxta in forum New To Java
    Replies: 11
    Last Post: 12-09-2011, 03:23 AM
  2. Simple Scanner Question (i hope)
    By elm101 in forum New To Java
    Replies: 1
    Last Post: 07-09-2011, 12:24 AM
  3. Simple question...I hope
    By marksey07 in forum New To Java
    Replies: 6
    Last Post: 01-07-2011, 05:40 PM
  4. Hello everyone! quick question.
    By irishhokie in forum New To Java
    Replies: 5
    Last Post: 04-03-2009, 04:13 AM
  5. quick pre/post increment question
    By xtrmi in forum New To Java
    Replies: 4
    Last Post: 02-01-2009, 05:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •