Newbie question regarding packages
- From: "snoopy_@xxxxxxxxxx" <snoopy_@xxxxxxxxxx>
- Date: 29 Mar 2006 17:09:37 -0800
I am going through a java for dummies book and have an issue compiling
a class. If I use "import com.mysite.util.Console" it compiles fine,
however if I use import com.mysite.util.* it fails. I assume this has
something to do with my CLASSPATH so I will include that as well...
Any insite would be appreciated. Thanks.
C:\javaclasses;.
Compiled Console.class file is in C:\javaclasses\com\mysite\util\
-----------------------------------------------------------------------------------------------
public class PackageTest
{
public static void main(String[] args)
{
while (Console.askYorN("Keep going?"))
{
System.out.println("D'oh!");
}
}
}
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
package com.mysite.util;
import java.util.Scanner;
public class Console
{
static Scanner sc = new Scanner(System.in);
public static boolean askYorN(String prompt)
{
while (true)
{
String answer;
System.out.print("\n" + prompt + " (Y or N) ");
answer = sc.next();
if (answer.equalsIgnoreCase("Y"))
return true;
else if (answer.equalsIgnoreCase("N"))
return false;
}
}
}
-----------------------------------------------------------------------------------------------
Snoopy_
.
- Follow-Ups:
- Re: Newbie question regarding packages
- From: Jubz
- Re: Newbie question regarding packages
- Prev by Date: Re: help needed - decompiling
- Next by Date: Re: Print error...please help
- Previous by thread: help needed - decompiling
- Next by thread: Re: Newbie question regarding packages
- Index(es):
Relevant Pages
|