Why java take enum type off

why java take enum type off?
When in switch statement, it become complex without enum type.
Enum can constrained the range of integer value. Taking enum type off,
method parameter checking will take lots effort.
can any way to replace the functions of enum type.

It was a disputable design decision.
The original C "enum" type is however somewhat flawy from its lack of encapsulation (its elements "pollute the global namespace" - they are for this purpose!) and would not seamless fit into the typed, OO Java philosophy.
Otherwise put, the original "C" enum fits well to the C philosophy but no to the C++ or Java one.

Similar Messages

  • Java Tutorial Enum Types Example

    The Java Tutorial example Planet (http://docs.oracle.com/javase/tutorial/java/javaOO/enum.html), includes the following expression as the denominator of a ratio: EARTH.surfaceGravity(). Could someone please explain how this works. It appears to send the previously defined EARTH constant to the surfaceGravity method with the result being returned to the place where the expression is located. However, normally it is the thing to the right of the dot operator that is sent somewhere and the result is returned to the thing to the left of the dot. Cheers.

    It appears to send the previously defined EARTH constant to the surfaceGravity methodNo. It calls the surfaceGravity() method on the EARTH item, which is a final variable, not a constant.
    normally it is the thing to the right of the dot operator that is sent somewhere and the result is returned to the thing to the left of the dot.Complete nonsense.
    1. The thing to the left of the dot is evaluated
    2. The thing to the right of the dot is invoked with the value of the thing to the left of the dot as the value of 'this'
    3. The thing to the left of the dot is also used to identify the class containing the method if it's a class name. In this case it isn't, it is a variable.
    4. The result of the thing to the right of the dot is returned to as an operand to the containing expression.

  • Why is the Options/Content Turn off Java check missing. Java won't turn off

    You removed the Check box from the Options/Content menu to turn off Java, and turning it off under app's has no effect. Java stays on no matter what I do.

    removing useful features to force users to use third-party add-ons is not considered "as part of an effort to simplify the Firefox options " your complicating simple things and creating problems just of the sake of it .
    the content used to have 3 things, 2 options are gone , load images automatically and enable java script .
    the jave scirpt had three sub options that i used frequently
    now I'm forced to install firefox 22 ,it will solve the problem.

  • Java 5 Enums serialization with XMLEncoder...

    Hello,
    I'd like to know why a bean attribute whose type is a Java 5 enum is
    not saved when using XMLEncoder. This field is in fact ignored...
    Anybody knows how to persist such fields using standard JDK (I mean
    no third party library) ?
    public enum TestBeanEnum {
        R160x100,
        R320x200,
        R640x480,
        R800x600,
        R1024x768,
        R1280x1024,
        R1600x1200;
    public class Setup {
        private TestBeanEnum a0;
        private boolean a1;
        public Setup() {
        public boolean isA1() {
            return a1;
        public void setA1(boolean a1) {
            this.a1 = a1;
        public TestBeanEnum getA0() {
            return a0;
        public void setA0(TestBeanEnum a0) {
            this.a0 = a0;
        private static void save(Setup setup, File file) throws IOException {
            FileOutputStream out = new FileOutputStream(file);
            XMLEncoder encoder = new XMLEncoder(out);
            encoder.writeObject(setup);
            encoder.close();
            out.close();           
    ...Only the attribute a0 is not saved all over, even relatively complex data
    types are automatically persisted.
    I also find a strange behavior, the keyword "transient" seems to be ignored
    by the XMLEncoder and a transient field is made persistent !!!
    Did I miss something ? Is this strange behavior a bug ?
    Thanks for all,
    David Crosson.

    looks like a bug to me
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5015403

  • Enum type class hierarchy.

    Hi,
    I was reviewing and eagerly testing the Typesafe Enum Facility (enum types) on 1.5.0 beta, which is still in Public Review in the JCP (JSR-201).
    I would would like to mention a missing feature that I find usefull and powerfull for a custom framework architecture.
    I understand and agree with respect to the first question on the JSR 201 FAQ, about subclassing enums.
    Having enumeration constants from both the superclass and the subclass is quite confusing and I agree with disallowing it from the language.
    But I miss the ability to inherit custom behavior (methods, and not enumeration constants), for an enum type, from a middle superclass. This middle superclass could be a base class for enum types within a specific development framework (and of course, java.lang.Enum would by in is class hierachy).
    The actual proposal allows for an enum type to only have java.lang.Enum as superclass, from which it inherits methods like name() and ordinal(). But in a proyect where a large number of diferent enum types with a common and custom extra framework behavior (like a localizedName() or propertyKey() method for example) would need the implementation of this behavior in each enum type source code (or in a helper class).
    Following the example above, the actual proposal would need the following coding in order to add an additional behavior to all (or some) of the enum types in a development proyect:
    public interface MyBaseFrameworkEnum {
         String localizedName();
         String propertyKey();
    public enum FooEnum implements MyBaseFrameworkEnum {
         FOO_A, FOO_B;
         public String localizedName() {
              //..... coding necesary in every enum implementing BaseFrameworkEnum
         public String propertyKey() {
              //..... coding necesary in every enum implementing BaseFrameworkEnum
    As you see, every enum type in my example framework (like FooEnum) would need to code both methods localizedName() and propertyKey() which would produce a lack of centralized code and increase of class file size.
    It would be very powerfull to be able to use the following coding:
    public abstract enum MyBaseFrameworkEnum {
         public String localizedName() {
              //..... coding centralized
         public String propertyKey() {
              //..... coding centralized
    public enum FooEnum extends MyBaseFrameworkEnum {
         FOO_A, FOO_B;
    As you see, with this abstract enum MyBaseFrameworkEnum (which does not falls in the subclassing problem mentioned in the FAQ) does not define enum constants and will pass its custom behavior to its subclass enums. thus centralizing the related code.
    I generally use an implementation of the Typesafe Enum Pattern so I really am looking forward for this new Typesafe Enum Facility in the Java language. But, as an example, I generally use common features in my enums, a properyKey() method used to get a unique key in order to internationalize my applications, since a description to enums is normally needed to be displayed to users.
    I believe this capability would be very powerfull in cases where common features are needed for enums in a development proyect with respect of:
    - code centralization and maintainance.
    - class file size.
    - source code readability.
    This extension would not contradict the actual definition, it would only allow for an enum type to be able to extend from another abstract enum type which has no enumeration constants.
    I believe that if there are other programmers that find this extension worth, it could make it in the JSR-201(which is in public review until February 21th) process before the final specification.
    Regards,
    Luis Longeri

    It would be very powerfull to be able to use the
    following coding:
    public abstract enum MyBaseFrameworkEnum {
         public String localizedName() {
              //..... coding centralized
         public String propertyKey() {
              //..... coding centralized
    public enum FooEnum extends MyBaseFrameworkEnum {
         FOO_A, FOO_B;
    }Luis, I like your idea but don't really like the idea of an abstract enum. I think this would be better
    public class MyBaseFrameworkEnum extends Enum {
         public String localizedName() {
              //..... coding centralized
         public String propertyKey() {
              //..... coding centralized
    public enum FooEnum extends MyBaseFrameworkEnum {
         FOO_A, FOO_B;
    }However, this always opens up the risk of you breaking the enum specific stuff, so all the vulnerable Enum methods would need to be declared "final".
    Because you are unlikely to see this in the language any time soon (if at all), you can always centralise your code in some static methods that take the enum as an argument
    public class MyBaseFrameworkEnumTools {
         public String localizedName(Enum e) {
              //..... coding centralized
         public String propertyKey(Enum e) {
              //..... coding centralized

  • Why Java doesn't allow to reduce the accessibility of a method du

    Why Java compiler does not allow to reduce the accessibility of a method during inheritance?
    ( Eg; If the base class has a public method and if that method is overridden in child class but
    with defuault access, it gives compile error)
    Supposed answer:
    Because in the runtime, it cannot check the access modifier.
    Suppose A is the base class. It has a method fun() as public.
    B is the derived class of A.
    Suppose in some other class (say C) there is a method myFun() which takes A as parameter and
    calls the fun() method of A. So that method can take B
    also as parameter (As it is derived from A).
    So if the fun() method's accessibility is reduced in B, whether "that can
    be called in C or not" is not known. that is why compiler does not
    allow the reduce the accessibility of a method during inheritance.
    Member variables do not have this problem as they can be checked at
    compile time.
    Is this explanation correct?

    You can give private access, sort of... you could fake it, if the goal is to prevent someone from doing what the method does. Of course, they could (as long as A isn't abstract) create their own A and do whatever they want.
    class A {
       public void doThis() {
    class B extends A {
       public void doThis() {
          // explicitly do nothing
    }But I think generally, this shouldn't be a problem. I'm not sure if it's something that is common for creating an API to subclass another class to hide the superclass's methods. Usually you are adding functionality to a subclass that is for more specific things then the superclass supports. I mention creating an API because if it's just for some application class, then you are writing it, so use or not use the methods as you want. It's APIs for library type classes that other people would use, and if you are extending the library, and really need people not to call methods for some reason, document it. Maybe a good place for an assertion?

  • **Tech explanation why BACKUPS take long, how to make it very short, etc*

    I noticed my backups to increase quite a bit over the last few days. I also noticed so many posts on why are backups taking so long, what can I do (only solution given is to click x or modify so that backups are not done, etc). Well to answer all those that want the "real" answer, I decided to do a few minutes of research and share what I've learned. I have seen nothing at all on google or anywhere else about the recommendations I'm suggesting, but from my experience I think it will answer 99% of all the backup threads on this site.
    All your backups are being stored in:
    XP: C:\Documents and Settings\(Your Name)\Application Data\Apple Computer\MobileSync\Backup\
    Vista: C:\Users\*Your User*\Appdata\Local\Apple Computer\
    Mac: ~/Library/Application Support/MobileSync/Backup
    The main directories are GUIDs that are based on the version of the iphone, so you may see more than one folder. Make sure to view the date last modified of the folder to make sure you go into the latest one. Order the files inside this directory by date modified. Here you can see how many files are being updated ON EVERY BACKUP. The older ones are not being backed up anymore because you probably uninstalled that app on the iphone (apple doesn't delete old unnecessary backup files that won't be ever used - bad programming #1). They are encoding all these files and inside the files in base 64, so you can decrypt them to view the contents, but you don't really need to and I don't have to show how for the solution to this. Open a file in wordpad. Within the first few lines you'll get an idea of what the backup is.
    So here is the solution....sort these files by date modified. My biggest single file was 29,582KB!! looked inside and it's the WeDict app. There are other files from WeDict, but obviously for me if I want fast backups I need to get rid of this app. A few other top files I found are awesome apps on the iphone that have awesome trailers, intro movies for games, etc. Well guess what, they backup every single game intro, trailer, etc. So for instance, the game tap tap tap has a few m4a songs....well every one of those m4a songs are encrypted and backed up EVERY TIME (apple backups up files that don't need to be backed up which would probably reduce backup times by at least 98% - for instance, intro movies don't need to be backed up, nor app songs, nor game instructions, etc because that information should be on itunes backed up separately when you install an app, not when you do backups and it should be smart enough to update that folder when a new version is out....and only do backups on files that can change like high scores in apps, notes, etc - bad programming #2).
    So anyway, you can see which apps are taking the most amount of time. Obviously if you remove every app on your iphone, it will backup fast, but some of these apps are shockingly huge. Problem here is that you can have 1 file or 100 files associated with 1 app. You could have only 2 apps installed on your iphone and your backups could be slower than a person having 30 apps just because some apps take a ridiculous amount of more backup data and time and what makes this even worse is every part of the data is encrypted, which I will talk about below (which doesn't need to be). Only time that file is not going to get updated is if it's deleted from your iphone.
    You don't HAVE to use base 64 encryption. Come on now, especially on apps? They could lighten the encryption and it would be much faster backups because it has to decode and encode every file now. You are overencrypting these files so huge programs take forever backups. (Bad apple programming #3 don't over encrypt when speed is a necessity on something that doesn't need extreme high security).
    As a developer with a computer engineering degree, to also make it even faster than what users were experiencing with backup times prior 2.0. They are obviously not tagging each portion that needs to be backed up individually. Lots of software companies do this to speed stuff up. For instance if you have Kaspersky antivirus with the defaults, the first scan will always take long, but every scan afterwords will be fast because instead of rescanning that file for a virus, it just checks to see if the checksum has changed and if so rescan that file, so most of the time the scan will happen fast unless there has been a period of time that you haven't done one that updates the checksums. They could do something very similar with this. So basically even if you changed a few things on your phone, the backup should be only a few seconds because only those few changes would be signaled to be rebacked up. (bad apple programming for backups #4). This process can make backups be from 98% faster to 99.98% faster....meaning having a backup only take 4 seconds even with 100 apps installed. Actually coding this one thing would make it extremely fast, but would take the most programming time. You can even make an algorithem where for the whole backup process it would just have to read one file that it would check checksums and then tell it to modify 1 or 2 other files and that's it as opposed to backing up (for me almost 5,000 files) some being several MB in size.
    So all the above should give apple suggestions on how the can speedup backups by 99.98% faster than how they are doing it now and then anwers all those questions why it takes longer, what needs to change, how can I shorten my backups (this way you can find out what apps are taking the most time), etc.
    The problem here is apps will continue to grow, become larger, more trailers, movies, songs embedded inside apps, etc. This problem is only going to grow. The additional problem is that they can say they have tweaked the backup programming to make it faster, just like they did in 2.0.1, but backups seem slower because there are newer better more awesome apps out!! Well that's why it doesn't look like it's faster but it's slower! They will keep doing this as opposed to solving the root of the problem by recoding the whole backup foundation as I'm suggesting from above. Backups will forever take longer and longer and longer and longer. That is what you have to look forward to. My guess is that they are not going to fix the foundation of how backups are done anytime soon having a good idea how they are doing this one. They would have to do a massive overhaul of the whole backup code, which basically they would have to admit that all the time coding this way was a waste and they see no profit from it and we deal with it just by pressing x sometimes. We can complain all we want, but for awhile if you don't want long backups, this is the real solution. What's funny is writing this email took much more time than figuring out what apple is doing, but I think this will help many apple iphone users. Let me know what you guys think.

    Supposedly apple made backups slightly faster on 2.0.1, but like I said in my original posting above...it will get worse and worse because of the apps.
    Just to verify and you could do this yourself. Right before you plug in to sync and it auto starts the backup process do this...go to the folder where all the files are as mentioned above, sort it by date modified. Add a refresh button on the toolbar. Then start the sync/backup, keep refreshing and you see the files getting updated. There are even temporary files apple's backup process creates that you don't see that keeps adding to a file, so even if you see one file updated, you might see it updated a few times until the whole backup for that file completes.
    Here are my stats:
    For me this time it took 27 minutes (earlier it took 2 minutes, but like i said with updates to apps, more apps, depending on types of apps, your computer speed, etc it will increase.
    For me: In 27 minutes, it updated 1707 files with a total size of 82.8MB. There are a ton of computers that are much faster than mine that I'm sure would cut the minutes down. I have 6 pages of apps, but like I mention above, that doesn't matter because you could have one app that has 400 files with a large size. I would be interested in others posting their results, maybe in this format:
    27min 1707files 82.8MB Pentium4HT Antivirus and other large programs running in background.
    If you are interested you can even download program that will decrypt these files so you can view them in more detail...for mac, for instance, there is something like this: http://mac.softpedia.com/get/iPhone-Applications/Tools-Utilities/iPhone-Backup-D ecoder.shtml It allows you to backup and modify. It may help you decide what is taking your backups so long and you can decide if it's worth having that app installed versus not having a good backup. You can also pick out you sms backup file, contacts backup file, etc for those really interested in having backups of those specific files.
    Hope this helps clear up things for everyone.

  • Why java file name and class name are equal

    could u explain why java file name and class name are equal in java

    The relevant section of the JLS (?7.6):
    When packages are stored in a file system (?7.2.1), the host system may choose to enforce the restriction that it is a compile-time error if a type is not found in a file under a name composed of the type name plus an extension (such as .java or .jav) if either of the following is true:
    * The type is referred to by code in other compilation units of the package in which the type is declared.
    * The type is declared public (and therefore is potentially accessible from code in other packages).
    This restriction implies that there must be at most one such type per compilation unit. This restriction makes it easy for a compiler for the Java programming language or an implementation of the Java virtual machine to find a named class within a package; for example, the source code for a public type wet.sprocket.Toad would be found in a file Toad.java in the directory wet/sprocket, and the corresponding object code would be found in the file Toad.class in the same directory.
    When packages are stored in a database (?7.2.2), the host system must not impose such restrictions. In practice, many programmers choose to put each class or interface type in its own compilation unit, whether or not it is public or is referred to by code in other compilation units.

  • Int to enum type loookup

    I am iterating in a while loop and using the index terminal to build an array of differnet values of the same enumerated type control that are from a strict type def enumerated control. What I want to do is to iterate and do a comparison and if the comparison holds, I want to build an array of the correlating enumerated types so that I can use this later on.
    I am using a Function that came with the state diagram toolkit called "int to enum" that the state diagram uses when calculating its next state info. It seems to bomb out when I attempt to wire my enum type control to its input.
    Any ideas?

    I have not used the state diagram toolkit but have extensively employed enums from typedefs. This is very convenient since for comparisons just compare it to a constant version of the typedefs. If you use a strict typedef remember that almost everything must be identical and this causes many problems. Since typedefs of enums rarely have to be strict I would think about why you chose a strict type def as opposed to a normal typedef. One additional added feature is that when wiring a enum typedef to a case structure you can populate the case with the enum named cases. I would speculate that your problems are due to the use of a strict typedef which is only necessary when you are concerned with more than just a typdef's structure and values (i.e aesthetic properties). Hope this helps (again I have not used the state diagram toolkit).
    -Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • Query on conversion between String to Enum type

    Hi All,
    I would like to get advice on how to convert between char and Enum type. Below is an example of generating unique random alphabet letters before converting them back to their corresponding letters that belonged to enum type called definition.Alphabet, which is part of a global project used by other applications:
    package definition;
    public enum Alphabet
    A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S,
    T, U, V, W, X, Y, Z
    public StringBuffer uniqueRandomAlphabet()
    String currentAlphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    StringBuffer randomAlphabetSB = new StringBuffer();
    for (int numberOfAlphabet=26; numberOfAlphabet>0; numberOfAlphabet--)
    int character=(int)(Math.random()* numberOfAlphabet);
    String characterPicked = currentAlphabet.substring(character, character+1);
    // System.out.println(characterPicked);
    randomAlphabetSB.append(characterPicked);
    StringBuffer remainingAlphabet = new StringBuffer( currentAlphabet.length() );
    remainingAlphabet.setLength( currentAlphabet.length() );
    int current = 0;
    for (int currentAlphabetIndex = 0; currentAlphabetIndex < currentAlphabet.length(); currentAlphabetIndex++)
    char cur = currentAlphabet.charAt(currentAlphabetIndex);
    if (cur != characterPicked.charAt(0))
    remainingAlphabet.setCharAt( current++, cur );
    currentAlphabet = remainingAlphabet.toString();
    return randomAlphabetSB;
    // System.out.println(randomAlphabetSB);
    I got the following compilation error when trying to pass (Alphabet) StringBuffer[0] to a method that expects Alphabet.A type:
    inconvertible types
    required: definition.Alphabet
    found: char
    Any ideas on how to get around this. An alternative solution is to have a huge switch statement to assemble Alphabet type into an ArrayList<Alphabet>() but wondering whether there is a more shorter direct conversion path.
    I am using JDK1.6.0_17, Netbeans 6.7 on Windows XP.
    Thanks a lot,
    Jack

    I would like to get advice on how to convert between char and Enum type. Below is an example of generating unique random alphabet lettersIf I understand well, you may be interested in method shuffle(...) in class java.util.Collections, which randomly reorders a list.
    before converting them back to their corresponding letters that belonged to enum type called definition.AlphabetIf I understand well, you may be interested in the built-in method Alphabet.valueOf(...) which will return the appropriate instance by name (you'll probably have no problem to build a valid String name from a lowercase char).

  • HT4009 Purchasing gems on the clash of clans game.  It tells me to contact customer support   This happens a lot  and support takes the block off my account  and everything works fine. Looking forward to y'all resolving my issue   Ryan Hinger

    Purchasing gems on the clash of clans game.  It tells me to contact customer support   This happens a lot  and support takes the block off my account  and everything works fine. Looking forward to y'all resolving my issue   Ryan Hinger

    If you are getting a message to contact iTunes support then only they can help you (these are user-to-user forums, we won't know why you are getting the message) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page

  • % operator in Enum Type

    Dear fellow developers,
    Below is code calculating your weight on different planets using Enum type, from the book of Sun on Java Tutorials. Can anyone tell me what does "%" mean in "%s", "%f" and "%n"?
    How does all three managed to get in the for-each loop without being declared explicitly before it?
    public enum Planet {
    MERCURY (3.303e+23, 2.4397e6),
    VENUS (4.869e+24, 6.0518e6),
    EARTH (5.976e+24, 6.37814e6),
    MARS (6.421e+23, 3.3972e6),
    JUPITER (1.9e+27, 7.1492e7),
    SATURN (5.688e+26, 6.0268e7),
    URANUS (8.686e+25, 2.5559e7),
    NEPTUNE (1.024e+26, 2.4746e7),
    PLUTO (1.27e+22, 1.137e6);
    private final double mass; // in kilograms
    private final double radius; // in meters
    Planet(double mass, double radius) {
    this.mass = mass;
    this.radius = radius;
    private double mass() { return mass; }
    private double radius() { return radius; }
    // universal gravitational constant (m3 kg-1 s-2)
    public static final double G = 6.67300E-11;
    double surfaceGravity() {
    return G * mass / (radius * radius);
    double surfaceWeight(double otherMass) {
    return otherMass * surfaceGravity();
    public static void main(String[] args) {
    double earthWeight = Double.parseDouble(args[0]);
    double mass = earthWeight/EARTH.surfaceGravity();
    for (Planet p : Planet.values())
    System.out.printf("Your weight on %s is %f%n",
    p, p.surfaceWeight(mass));
    Thank you in advance.

    DanielTan_NL wrote:
    How does all three managed to get in the for-each loop without being declared explicitly before it?They are declare. Right here.
    >
    public enum Planet {
    MERCURY (3.303e+23, 2.4397e6),
    VENUS (4.869e+24, 6.0518e6),
    EARTH (5.976e+24, 6.37814e6),etc.
    Every enum has a values() method that returns an array of the values you define for that enum.

  • Can enum type be used in web service

    I am confused about how to use a enum type in web service interface, please do me the favor

    yep, that I assumed that was the category. I meant, What are you trying to do? Is this a webservices specific question or a question about how to use Sun Java Studio Enterprise and Web Service?? If this is a Web Services specific question, try posting to the Web Services forum.
    http://forum.java.sun.com/forum.jspa?forumID=331
    I searched this forum for postings related to your question but did not find much.

  • Java console not displaying off internet explorer view tool bar

    Hello,
    I'm curious why my java console is not displaying when i click on it?
    Internet Explorer: View: Java Console
    and it doesn't work
    does anyone know why this maybe?
    Thank you...

    Basically,
    just to add to it...
    I am trying to access a website that has a NETLET from Sun Microsystems display
    when accessing the website. When i do that from my computer...the NETLET does not
    display...The NETLET runs on Jvm..virtual machine...I wondering if anyone knows why this isn't working...This relates to the Java console not working off of Internet Explorer..they seem to be correlated..Thank you

  • Why java is secure?

    hello friends
    this is my first message on this site. i want to know that what makes java more secure then C or C++?

    Some of the thing that makes Java more "Secure":
    1. auto garbage collector
    developer does not have to worries about a memory leak (most of the time - for dangling reference, etc). Java does the releasing of unreferenced object for you
    2. hide pointer
    Java hide pointer from developer. Allowing direct access to memory can be dangerus. Hacker can takes advantages of this to try to overwrite memory outside of application..or you accident overwrite th ewrong address in your pointer arithmetic.
    3. try-catch
    java provides try - catch - finally that is different from C++ try-catch.
    Java guareentee that when the an Exception occurs, the thread will goto the end of the method before unwinding the stack to where the call was..and keep doing this till the exception is handled. This is important when working with thread. When the thread exit the method..and if the thread have the object lock..then it release the lock upon exiting the method. Java try-catch-finally guareentee the release of the lock (because Java exit the method). C++ does not guareentee this (well..i haven't work with C++ for a long time..it may have changed)..so when you throw the Exception..the lock may not be released.
    4. Java is a String type language
    you have two type in Java
    primitive type and object type.
    At runtime, Java knows the type of object, so Java knows what operating allows on th etype...this eliminate bad casting (for the most part)
    you can still cast wrongly:
    Person p = new Person();
    Object o = p;
    Cat c = (Cat) o;compile fine, but will catch runtime exception..because Java knows the type at runtime..so trying to cast to a Cat for the Person object will generate an Exception...In C++..your application may or may not crash right there....so, you could actually keep on running and may or maynot get a runtime error (but your result may be incorrect)
    5. Applet provides better security
    Applet by default does not gives the Applet application permission to read or write on your computer. ActiveX (from Miscrosoft) default to allow these access.
    This encapsulte the applet..and prevent malacious code.
    as stated before..you can still write code that is not so "secure," it's just harder to do so, than any other language..Java try to protect developers from making these mistakes..and try to protect the end-user from malacious code.

Maybe you are looking for

  • Mt iTunes won't open at all! someone help me please?

    Basically,I click on my iTunes icon on the computer,and it won't open. Why is that happening?

  • Report to find user ids which are expiring ...

    Hi all, We need to have a report which will give a list of people whose SAP ID passwords are expiring so that they can change their passwords. Is there any standard report to get this list ? If we need to have a custom report where can we get the dat

  • White windows, missing components

    I really was trying to get a solution for my problem: searched forums and in java2d faq: "Why are my Swing components not displaying properly? Why are they showing up as white windows instead? How do I fix this?" -the funny thing is, it was missing t

  • How to turn the pulsating white light off?

    We bought a 1.25Ghz PowerMac G4 around July 2004. It was one of the last production units of that model. We also bought a 17" display at the same time (which is why I'm posting here even though I'm not sure of the exact model.) The display in questio

  • Add some values from array B into array A only if other values exist in both.

    Hi everyone, If I have reference array $Food that has 2 property names that I'm going to use to compare to another array..... Pie                 WasAte blueberry         no pecan               no raspberry           no And I collect another array ca