I am trying to compile the following java code with the beta version
of java 1.5.
import java.*;
public class hello {
public enum test { a, b, c, d, e };
public static void main(String[] args){
System.out.println("hello world");
}
}
I get the following error:
$ javac hello.java
hello.java:5: warning: as of release 1.5, 'enum' is a keyword, and may not be us
ed as an identifier
public enum test { a, b, c, d, e };
^
hello.java:5: ';' expected
public enum test { a, b, c, d, e };
^
1 error
1 warning
Am is missing something ?
Thanks 2 5480
"Parag" <dv***@routepulse.com> wrote in message
news:38**************************@posting.google.c om... I am trying to compile the following java code with the beta version of java 1.5.
import java.*;
public class hello {
public enum test { a, b, c, d, e }; public static void main(String[] args){ System.out.println("hello world");
} } I get the following error:
$ javac hello.java hello.java:5: warning: as of release 1.5, 'enum' is a keyword, and may not
be us ed as an identifier public enum test { a, b, c, d, e }; ^ hello.java:5: ';' expected public enum test { a, b, c, d, e }; ^ 1 error 1 warning Am is missing something ?
Thanks
Yes, you are missing the -source 1.5 directive to your compiler.
Silvio Bierman
Thanks, that did the trick.
"Silvio Bierman" <sb******@idfix.nl> wrote in message news:<40***********************@news.xs4all.nl>... "Parag" <dv***@routepulse.com> wrote in message news:38**************************@posting.google.c om... I am trying to compile the following java code with the beta version of java 1.5.
import java.*;
public class hello {
public enum test { a, b, c, d, e }; public static void main(String[] args){ System.out.println("hello world");
} } I get the following error:
$ javac hello.java hello.java:5: warning: as of release 1.5, 'enum' is a keyword, and may not be us ed as an identifier public enum test { a, b, c, d, e }; ^ hello.java:5: ';' expected public enum test { a, b, c, d, e }; ^ 1 error 1 warning Am is missing something ?
Thanks
Yes, you are missing the -source 1.5 directive to your compiler.
Silvio Bierman This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jochen Daum |
last post by:
Hi,
I have to emulate a "file upload" to a Java Servlet which is done with
the class URLConnection.
The java source basically does
URLConnection conn =...
|
by: SpaceCowboy |
last post by:
I recently got into a discussion with a co-worker about using enums across a
dll interface. He wanted to use chars instead, argueing that depending on
compiler settings the size of an enum could...
|
by: Hexar Anderson |
last post by:
Why can't you pin an enumeration? For example, the with the following code:
public enum MyEnum : byte
{
ValueOne = 1,
ValueTwo = 2
}
public class MyClass
{
|
by: David Veeneman |
last post by:
I want to data bind a user control and a business object, using a
BindingSource control. The control has a 'Priority' property that takes a
'Priority' enum (High, Normal, Low). The business object...
|
by: Stefan Mueller |
last post by:
Because the characters ', ", ... make troubles in my input boxes I use the
following PHP command while generating the page
htmlentities($my_var, ENT_QUOTES);
However, if I use in my java scripts...
|
by: Stefan Mueller |
last post by:
I read data (e.g. äöüÄÖÜçéàè"') from my MySQL database which I'd like to
show in an input box.
<?php
$mysql_data = "äöüÄÖÜçéàè\"'";
$html_data = addslashes(htmlentities($mysql_data,...
|
by: nomad |
last post by:
Hi,
I would like to create a enum which consists of contenttype i.e. text/
xml and application/x-www-form-urlencoded. Would this be possible?
Appreciate any suggestions.
|
by: falconsx23 |
last post by:
Hi, I need help with my java program. I am new with java, so go easy on me if this is a dumb question.
Ok the question is
"You will complete two methods for this exercise. The headers (and a...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |