-
trouble with a class
Hi:
I have a problem with the following class:
import java.io.*;
public class CCadenas
{
//turn String into UpperCase chars
static void LowecaseUppercase(char[] str)
{
int i=0, desp = 'a'-'A';
for(i=0;1<str.length&&str[i]!='\0';i++)
if (str[i]>='a'&&str[i]<='z')
str[i]=(char)(str[i]-desp);
}
public static void main(String[]args)
{
char[]cadena=new char [80];//character String
int car, i=0; //a character and subindex for matrix
try
{
System.out.println("Type in a character string:")
while ((car=System.in.read())!='\r'&&i<cadena.length)
cadena[i++]=(char)car;
\\turn Lowercase into Uppercase
LowercaseUppercase(cadena);//calling method
System.out.println(cadena);
}
catch(IOException ignorada) {}
}
}
when I run it I get the following message:
C:\PRUEBAS>javac CCadenas
javac: invalid flag: CCadenas
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-help Print a synopsis of standard options
It seems like an error in trying to find the class in my folder but my class is on the correct classpath and everything and my question is if you could give me an idea on what the problem might be considering this list of errors I get.
Thanks in advance!!
-
When you compile a Java program you have to include the .java:
Quote:
javac CCadenas.java
Once it compiles without errors, you can run as follows:
Luck,
CJSL
-
Thank you so much!
Man! sometimes the answer is simply staring you in face isn't it?
thank you for your words of encouragement studying java is really also about lots of motivation.