Annotations Question

I came across this question in mock SCJP exam.
interface A
    void x();
class B implements A
   public void x()
    public void y()
class C extends B
   public void x()
And :
java.itl;List<A> list=new java.util.ArrayList<A>(); //LINE 20
list.add(new B());                   //LINE 21
list.add(new C());
for(A a:list)            // LINE 23
   a.>(),
   a.>()                //LINE 25
What is the result
A. THe code runs with no output
B. An exception is thrown as runtime.
C. Compilation fails because of an error in line 20.
D. Compilation fails because of an error in line 21.
E. Compilation fails because of an error in line 23.
F. Compilation fails because of an error in line 25.
ANSWER : FI am totally clueless about this question.Can anyone let me know where i can find pointer to this example ?
Thanks in Advance.

sunjava84 wrote:
I didn't get lines 20,23 and 25.
java.util;List<A> list=new java.util.ArrayList<A>(); //LINE 20What don't you get about line 20? The "<A>"? Generics were introduced in 1.5. Perhaps you only know an old version of Java.
[http://java.sun.com/docs/books/tutorial/extra/generics/index.html]
[http://java.sun.com/docs/books/tutorial/collections/index.html]
for(A a:list)            // LINE 23[The for-each loop|http://java.sun.com/j2se/1.5.0/docs/guide/language/foreach.html] was also introduced in 1.5
   a.>()                //LINE 25That line is garbled. I think they meant to simply call a method, like:
a.clear();By the way, [annotations |http://java.sun.com/j2se/1.5.0/docs/guide/language/annotations.html] were also introduced in 1.5, but they don't appear in this example.

Similar Messages

  • Annotations - error in Sun Tutorial?

    In the Q&E section of The Sun Tutorial on Annotataions (http://java.sun.com/docs/books/tutorial/java/javaOO/QandE/annotations-answers.html), it says,
    Question 2: Compile this program:
    interface Closable {
    void close();
    class File implements Closable {
    @Override
    public void close() {
    //... close this file...
    What happens? Can you explain why?
    Answer 2: The compiler generates an error complaining that File.close doesn't override any method from its superclass. This is because it is not overriding Closable.close, it is implementing it!
    But...
    I get no errors (or any other messages) and File.class and Closeable.class files are created.
    Is the tutorial wrong? Or something else?
    How would you change the sample code to get the answer the tutorial gives?
    Thank you.
    see also http://java.sun.com/docs/books/tutorial/java/javaOO/QandE/annotations-questions.html

    C:\Documents and Settings\ejp\Tests\src\OverridesTest.java:23: method does not override a method from its superclass
    Is that the code you actually compiled?

  • Weird quirk about java / swing

    I have a class that extends JComponent but is still abstract (I added some abstract methods to this class). The weird thing is that I get a warning about not having a serialize ID defined! Anyone else think that's kind of a bug / quirk?

    It says "use serialVersionUID from JDK 1.0.2 for interoperability" If you want to supress the warning use annotation
    Now the reason behind this is that your class is implementing java.io.Serializable if you do not want your class to be serializable then remove this market interface otherwise you can do the following to supress the warning
    @SuppressWarnings( "serial" )public class Main implements Serializable {If you don't define it ("private static long serialVersionUID"), then, whenever the class is serialised / deserialised a serialVersionUID will be generated, and if the serialising generation does not match the deserialising generation,which will be generated from that JVM's version of the Class, the deserialisation will fail, even if the Class definitions where compatible. When we say the class is compatible which means the class has not been changed.
    I hope this make sense to you. If not please let me know.
    BTW, this is not a Swing question but rather annotation question. Can the moderator please remove this post. Thanks
    Regards,
    Alan Mehio
    London, UK
    Edited by: alan_mehio on 22-Apr-2009 20:47

  • Questions on the @ServiceClient annotation and Asynchronous webservices

    1. Is their a way to invoke a webservice in an asynchronous manner without using the @ServiceClient annotation? I’ve tried a few things to get access to the async versions of the web methods and each time I get an exception stating “java.rmi.RemoteException: Asynchronous methods can only be invoked from stubs with the ServiceClient annotation”.
    2. Is their anyway to generate a dynamically sized array of service port variables with the @ServiceClient annotation? All the examples that I have seen only have a single port variable annotated with @ServiceClient. I’ve tried creating a class that uses the @ServiceClient annotation, and while it does compile it fails when I try to invoke the services methods. I also found in some documentation a restriction that the @ServiceClient annotation can only be used in the core java (jws) webservice class.
    3. Is their a way to use a single service port variable with the @SeriviceClient annotation to invoke multiple calls to an asynchronous web method if that web method is part of a conversation? When I tried this I found that even though the asynchrounous calls were going out with any problems they were being processed serially on the target services side (I assume due to the conversation).
    The problem I am trying to solve is I need to invoke a stateful webservice in an asynchronous manner multiple times from the same starting service.

    Hi
    That is how I understand that document:
    Locking: Forms, by default, locks a row as soon as the user starts modifying the data. That is pessimistic locking. Apex, on other hand (and optionally forms also) do not lock the record, but before applying any changes checks if the data has changed since the user queried it (what for some reason is called optimistic "locking")
    DB connections: I am not sure why they used the terms synchronous/asynchronous, but the difference is that Forms, by default, keeps an permanent DB connection while the user is using the application, while Apex gets a connection from a connection pool every time a page is requested/submitted.
    Architecture: Forms (in its web version at least) has 3 tiers: the browser, the appserver where the forms service runs and the database. As Apex runs inside the database, there are only 2 tiers: the browser and the database (though you still may need an http server in between which serves static content, I don't think it is considered part of the application in this context). If you are talking about client/server forms, then there are only 2 tiers.
    I hope this helps!
    Luis

  • @EJB annotation usage question.

    (excuse the repost, it was suggested I change the topic title)
    bear with me here. . . I am new!
    What I am trying to do is get a list of JDBC connection pools configured on an AppServer 9 installation.
    I created and successfully deployed a Session Bean (not even sure if this code will do what I want, but I will cross that bridge when I get there)
    ===============package com.ismsi.isms.ejb.login;
    import javax.ejb.*;
    import javax.naming.*;
    import java.util.Vector;
    @Stateless()
    public class LoginBean implements com.ismsi.isms.ejb.login.LoginRemote {
        public String[] getNamedConnection() throws NamingException {
            InitialContext ic =  new InitialContext();
            Vector<String> v = new Vector<String>();
            for(NamingEnumeration names = ic.list("java:comp/env/jdbc"); names.hasMore();)
                v.add( ((NameClassPair) names.next()).getName());
            return v.toArray(new String[v.size()]);
    ===============
    but I can't figure out how to connect to it.
    here is my client app:
    ===============package ismsClient;
    import com.ismsi.isms.ejb.login.LoginRemote;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.rmi.PortableRemoteObject;
    import java.util.*;
    import javax.ejb.EJB;
    public class LoginClient {
        public LoginClient() {
        @EJB
        private static LoginRemote login;
        public static void main(String[] args) {
           LoginClient client = new LoginClient();
           client.ListConnectionNames();
        public void ListConnectionNames(){
            try
      // *********** Here is the problem. . .  
              String[] s = login.getNamedConnection();
                for(int i = 0; i <s.length;i++ )
                    System.out.println(s);
    }catch (Exception ex) {
    System.err.println("Caught an unexpected exception!");
    ex.printStackTrace();
    }Why is login unassigned in LoginClient.ListConnectionNames?
    I thought the @EJB would do all the initialization/construction/InitialContext stuff for me.
    Please help a delphi/.netter come to the dark/light side :)
    cheers

    OK, now at this point you are either saying: "feck feck feck, that's
    obvious, I'll deploy the client to the app server and try again"
    OR "Yeah, I know that" That's a negatory on both counts, big bear.
    in which case you will want to have a look at
    a simple example and try building it yourself... Thanks for the link. I was googling on 'client +@EJB' and various other combinations, could only find stuff on previous version of EE. a cursory glance at your link appears it will clear some things up.
    So, the client app needs the full code jar that contains the session class as well???
    Forgive me for thinking .Net, but let me explain how I do things in .Net Remoting.
    In .Net, I compile a common assembly with an interface
    A server assembly is built with a class that provides implementation,
    A client assembly is built that activates from the remoting subsystem an object implementing the common interface.
    The client interface knows nothing about the internals of the server object, nor would I think it should have to. In .Net, i have an XML configuration file that specifies the URI from which to activate the object.
    So to answer your question - how is the app server to perform the injection? I don't know. . . thats what had me confused. . . I assumed that it would look for the interface implemenation on a local appserver if found. I also assumed that there would be an analogue to the Net configuration, in which I could specify a remote app server.
    On the other hand, I am getting more keywords to google on. . . 'injection' 'EAR'
    uh-oh. . . combining that with '+java +bean' will probably get me dozens of pediatric links dealing with toddlers putting coffee beans in their autic canals. . .
    thanks for the link!
    cheers
    bas

  • Question concerning Hibernate and EJB3 Annotation overlap

    Consider the following, from the JBoss EJB3 Tutorial:
    @OneToOne(cascade = {CascadeType.ALL})
    @JoinColumn(name = "ADDRESS_ID")
    public Address getAddress()
    return address;
    The above two annotations are applicable, using JBoss Libraries and Hibernate Libraries.
    If one wishes to use both JBoss EJB3 annotations, and Hibernate with Annotations,
    do annotations need to be used twice? Naturally, if Hibernate and Jboss identical
    annocations are imported, there will be a compilation conflict error.
    I know that full package names can be used on annotations to avoid that.
    So, if I used the above code snippet, and I want to Hibernate using
    the equivalent hibernate annotations, what should one ideally
    do and why?

    Zac1234 wrote:
    I know that Netbeans automatically may build and deploy the completed
    EJB using ant to gather resources behind the scenes.
    which is why you shouldn't use it to learn about things. It hiding things from you means you don't learn all you need to know.
    with V2.1, regardless as to the container software that I'm deploying the bean to,
    am I now required to have an appropriate XML deployment descriptor,
    yup, and the ANT build file is not it.
    or is this something unique to jsps/servlets?Not the same thing. Different deployment descriptors for different applications.

  • Question about JAX-WS together with EJB 3.0 on WLS 10.3

    Hi all,
    I am developing a application that it is running on WebLogic 10.3. The application expose EJB 3.0 methods as web services by @WebService & @WebMethod annotation. And my question is,
    1. Is there any way to specify the context path/root for those exposed EJB? Currently the contextpath is same as the EJB's name
    2. And is there a method to disable the "scanning" of JAX-WS annotation on startup/deployment? The reason behind is that, some of the EJB jar files are coming from other team. I need to deploy it as EJB but not as a web service.
    Thanks
    Regards,
    Rock

    Hi guys,
    Here is what Eduardo is talking about:
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=407022.1
    (Doc ID: Note:407022.1)
    Rgds,
    Fábio.

  • DigitalGraph Annotation at different axis-Y level although the value is same

    Hi,
    I have plot a graph with annotation and I found it labeling the axis-Y at the different level, with the same value.
    Please look at the screenshot I attached. I have attached the Vi too, simply run it will get the result as preview in screenshot. 
    So, 
    Any idea to fix this ? 
    and I need to know, 
    How the annotation actually label the axis-Y level ? (sometimes label at  '1', sometimes at '0', a reason behind it that cause this inconsistently ? a fix setting as written in cluster should have all the label at the same level, but why it behave up and down..) 
     Please help .. Thanks in advance..
    Attachments:
    forum.JPG ‏103 KB
    waveformlabel.vi ‏28 KB

    Hi,
    Thanks for sending your VI with your question. I've tried running it and it appears to run fine with the digital input waveform you have specified. Do you have any input data that you know causes an error that you could send to me? I have attached a screenshot of what happens when I run the VI, so let me know if that looks more like what you are trying to achieve.
    Also, the reason for the annotation switching between a 1 and a 0 along the various lines is because it is an indication of whether the digital signal on that line is high or low at that point, rather than a label on the y-axis itself. It shows that on, for example, line 4, the signal begins low, hence the 0 on the axis, before switching to high, hence the 1 on the axis. I'd be very grateful if you could let me know if this answers your question and don't hesitate to ask if you need anything else clarifying.
    Regards
    Jeremy T
    Technical Marketing Engineer
    National Instruments UK & Ireland
    Attachments:
    Digi waveform.JPG ‏146 KB

  • Memory question

    I have a couple of questions about memory.
    1. I have Corsair TwinX XMS PC3200 2x1024mb. settings at corsair are 2.5-3-3-6 It shows up in speedfan as:       
     FSB-DRAM................. CPU/14
     CAS# Latency............. 3.0 clocks
     RAS#to CAS# Delay..... 3 clocks
     Ras Precharge...............3 Clocks
    Cycle Time(tras).............7 Clocks
    Bank Cycle Time(trc)......10 clocks
    DRAM IdleTimer.............16 clocks
      I just want to run it at a better speed to get the most out of it.
    2. Plus my MB supports DDR266/333/400 modules. Does that mean I can't run the 433/500/533/550?
     When I started to overclock I had the DRAM set on 400 and with the OC it went to 424. with no problems. Then I had to drop it to 333 to keep OCing and got the DRAM up to 198 running stable. I had to drop the FSB so eventually the DRAM went to 184. I ran Sandra with the 424mhs setting and the 184mhz setting and the 184mhz setting was really a lot quicker...so I stayed there.
        Now how can I get better speeds out of the memory? Would it be better to buy a different memory to achieve my goals?

    MR,
    You Stated :
    1. I have Corsair TwinX XMS PC3200 2x1024mb. settings at corsair are 2.5-3-3-6 It shows up in speedfan as:       
    FSB-DRAM................. CPU/14
    CAS# Latency............. 3.0 clocks
    RAS#to CAS# Delay..... 3 clocks
    Ras Precharge...............3 Clocks
    Cycle Time(tras).............8 Clocks
    Bank Cycle Time(trc)......12 clocks
    DRAM IdleTimer.............16 clocks
      I just want to run it at a better speed to get the most out of it.
    The figures you posted above look more like figure you would have gotten from the memory Tab in CPU Z. Can you confirm this and also post all figures you get form the SPD Tab in CPU Z regarding your RAM. If you RAM setting are set to Auto in BIOS then the above figures are really your SPD readings that were applied by your BIOS Auto RAM setting feature.  The CPU Z SPD read out will confirm this. If this is the Case then you have Corsair TwinX2048-3200 Kit (3-3-3-8) vice the TwinX2048-3200C2 (2--3-3-6*) with the asterix annotated as [* These parts support 2-3-3-6 latency on Intel platforms, and 2.5-3-3-6 latency on AMD platforms.]. Double check your product number on your RAM and pay perticular attention to letters and/or numbers after TwinX2048-3200....>  Check result against listing the TwinX matched pair memory listing here http://www.corsairmemory.com/corsair/xms.html
    Plus my MB supports DDR266/333/400 modules. Does that mean I can't run the 433/500/533/550?
    You could likely use memory up to DDR 500 on your board if you wanted to OC and leave ram at 1:1 ratio. Higher memory  would be wasted money.
    Good luck,

  • Annotation does not transfer between android and windows....

    I originally asked this question in June.
    I bought a Kindle Fire.
    I downloaded Adobe for Android.
    I read some pdf's for work.
    I annotated them.
    I plugged the kindle into my desktop.
    I opened a file explorer on my desktop and went to look at the annotated files on my desktop using Adobe 11 reader.
    There was no annotation.
    There was no annotation when I copied the file onto my desktop.
    There still is annotation when I open the file on my kindle!!!!!!!!!!!!!!!!
    There is no sync problem because I am not moving the file through the cloud.
    I need the annotation to transfer so I can put it back into my library and continue using the annotated file for research and writing..
    Unless this software can do this kind of an operation it is useless to me and severely limits my ability to use my kindle.
    Is there a solution?
    Is there an update?
    My conversation in June was closed by staff after telling me to send the files to [email protected] because the discussion groups don't accept attachments.
    They promptly neglected to reply  to me.
    I have searched my spam folder and found nothing.
    Someone dropped the ball.....
    please pick it up....
    tell me what I have done wrong or that the software does not actually support this....
    or someone who can get this software to work under the conditions I described above please tell me how they did it....
    Awaiting your solutions.....
    solvemyproblemnow

    Hi,
    We are still investigating this issue and wanted to share few initial results with you.
    We are able to see this happening on device having Android version 4.4. Can you please confirm Android version on your device?
    And the good news is that things start working fine if we restart the device before connecting to the desktop.
    Quick steps you need to follow -
    1. Restart your device
    2. Now attach it to desktop
    3. Try to open files having highlighted text.
    It should work after following these steps. Please try and it should solve your problem for now.
    Thanks

  • QT Broadcasting through media server question

    Hey all,
    My question is this: does anyone know how (if its even possible) to use QT Broadcaster on MANUAL UNICAST to webcast to users connecting to a media server?
    for instance: G5 ---> media server <----user
    <----user
    <----user etc.
    I have been trying to set up the webcast as such: creating a manual unicast .sdp with the IP address of the media server contained within. upload the .sdp to the media server where the users will find it and connect to the stream.
    So far, all I get on the client side is a QT window that says, "Live Broadcast" and "ready".
    If the clients connect to the stream through the media server (which has its own static IP that matches the one in the .sdp) shouldn't they be able to view the webcast?
    Any and all thoughts are most appreciated.
    -=adam=-
    [email protected]

    Using Manual Unicast:
    Manual unicast is a method of broadcasting that requires you to export an SDP file from QuickTime Broadcaster to one receiving computer identified by its IP address. The receiving application can be a single QuickTime Player or QuickTime Streaming Server or Darwin Streaming Server. If the receiving application is QTSS or DSS, the broadcast is reflected and no longer limited to a single IP address.
    To broadcast via Manual Unicast:
    If necessary, click Show Details in the QuickTime Broadcaster window, and in the Network pane choose a preset.
    Choose Manual Unicast from the Transmission pop-up menu, and enter the IP address of the receiving computer (or accept the default IP address of your own computer if broadcasting to yourself as a test), the audio port and video port numbers (or accept the defaults if broadcasting one-to-one), and the buffer delay (or accept the default).
    If desired, also enter information in the Annotation section.
    Click Broadcast, and then choose Export from the File menu and SDP or Movie from the Export submenu.
    Specify a name for the SDP or movie file and click Export.
    If the file is exported directly to a QuickTime Player, the viewer opens the file using "Open Movie in New Player" to view the broadcast. If the file is exported to QTSS or DSS, the viewer instead uses "Open URL in New Player." Talk to your QTSS or DSS administrator to determine the correct URL.
    Viewing a QT broadcast:
    Your audience can view your live broadcast using either QuickTime Player or a web browser with the QuickTime Plugin. You determine how users will see the broadcast by distributing an announcement movie file, which is needed by QuickTime Player to "tune in" to your broadcast, or by creating a Web page that refers to the movie file.
    For best results, your viewers should use QuickTime 6. QuickTime Broadcaster streams can be viewed using versions as early as QuickTime 4, but some viewers may not be able to watch your broadcast if you choose compression methods that are not available in the older software.
    When viewers connect to your stream, progress messages appear about connecting, negotiating, and buffering, then the stream begins playing. Viewers can pause or stop the broadcast, but when they resume they'll jump to the current moment if they're watching a live broadcast.
    If viewers are watching an archived (or prerecorded) broadcast, they will be able to pause, rewind, or skip ahead using the QuickTime controls.
    Annotating your broadcast:
    You can add a title, copyright, and other annotations to your broadcast.
    If necessary, click the Show Details button in the QuickTime Broadcaster window. Then click the Network tab and fill in the desired fields under Annotations.
    Your audience can view this information by choosing Show Movie Info from the File menu in the QuickTime Player application.
    About Instant-On streaming:
    Viewers watching a streaming video with QuickTime 6 will benefit from Instant-On, an advance in Apple's patent-pending Skip Protection technology that dramatically reduces buffer, or wait, time for an instantaneous viewing experience. Viewers can click around or scrub video as if it was on their hard disk.
    Users must have a broadband connection to experience Instant-On. The responsiveness of Instant-On is affected by available bandwidth and size, or data rate, of the content. It can also be affected by the codec used. Hinted movies made using the QDesign Audio codec, for example, may not be Instant-On capable.
    Choosing a broadcast method:
    The size of your expected audience determines how you deliver the broadcast.
    For example, when broadcasting a live event to only one QuickTime Player, QuickTime Broadcaster can send a single stream using Mac OS X without server software.

  • Override JNDI names in persistence.xml and @resource annotation

    I have a Java EE 7 application that I am developing for use with both GlassFish and WildFly, but I have discovered that both application servers use a slightly different format for specifying JNDI names.
    In GlassFish the persistence.xml file references the data source jdbc/myDataSouce, but in WildFly the data source needs to be java:/jdbc/myDataSource.The same is also true for classes that are annotated with @Resource. In GlassFish the annotation for a class using JavaMail would be @Resource(name = "mail/myMailSession"), but to deploy onto WildFly this would need to be @Resource(name = "java:mail/myMailSession").
    The only solution I've got at present is using Maven to create two different releases of the EAR file, with one EAR file containing a persistence.xml file with the data source jdbc/myDataSouce for use with GlassFish, and the second EAR file containing a persistence.xml file with the data source java:/jdbc/myDataSource for use with WildFly. Unfortunately, I haven't found a solution for the @Resource annotation.
    I've taken a look at the documentation for glassfish-application.xml and glassfish-ejb-jar.xml and have tried using resource-ref to override the JNDI names but the application fails to deploy due to an error in the name.
    My question is does GlassFish provide any capability to override the JNDI names specified in the persistence.xml file and classes with the @resource annotation?
    Many Thanks
    Paul

    Have you been able to solve this? I'm attempting to understand what Web Server 7 can do with regard to Java Persistence and what elements of it require Glassfish.
    I've also spent great amounts of time in WS6.1 trying to figure out why a JNDI resource couldn't be found. The rules of thumb I've learned are:
    - Try dropping the *'java:/comp/env/* prefix; just use jdbc/pact part
    - Make sure all referrences (in web.xml and sun-web.xml) are identical with regard to that name.
    I'm hoping you're not still dealing with this (it's been two months!) but if anybody else stumbles on this, maybe it'll help them.
    Dave

  • Newbie Question--EJB 3.0/JPA deployment to Sun AS 9.0 not working

    I am new to EJB 3.0 and JPA technologies, so please excuse me for asking such a rudimentary question.
    I am developing a simple Java EE application running on Sun Application Server version 9.0.01, buuild b02-p01. I used the windows installer to set everything up for the server. I am using JDK 1.6.0.02
    I am using Eclipse Europa to develop the application. I have an Enteripse application that includes a EJB project and a Web project. I am using ANT to build the application. In the Web project I have placed an index.html file to ensure I can hit the web application berfore I go any farther. The web project has two servlets. In one servlet, I called the Remote Interface for the EJB and performed some operation. This reference is made using annotations. The EJB project has developed several persistence classes and one EJB with a Remote interface. Everything seems to be building correctly. I have used annotations to handle the EJB and Entity portion of the EJB project.
    When I deploy the application to the application server, I see no errors in the server log. As a matter of fact, the log file states the ear deployed correctly. When I go look at the admin console, I am not seeing any errors either.
    In my my-ejb-jar file I do not include a sun-ejb-jar.xml and the war file does not include a sun-web.xml. The sun-application.xml is not in the ear file. The ear file has the application.xml, The sever is generating the ejb-jar.xml from the annotations and creating the JNDI tree. The war file has the web.xml file.
    When trying http://localhost:7182/MyWebContext/index.html for hitting the Web container using my IE 6.0 browser I receive this:
    I am not geeting any errors from this URL.
    Any suggestions would be greatly appreciated.
    Thank you for taking the time to read my post.
    Russ

    Check the property names for configuring TopLink's internal connection pool. All of the JDBC property names should be prefixed with toplink.
    Refer to the TopLink JPA extensions guide for more information.
    http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-extensions.html
    Doug

  • Simple Java EJB question.

    When it comes to EJB v3 Remote and Local interfaces,
    (With JBoss EJB Container Software in mind, for this question,)
    -Does the Remote interface for the EJB include method signatures from the Bean class
    -that are to be seen
    -that are to be hidden?
    -Does the Local interface for the EJB include method signatures from the Bean class
    -that are to be seen
    -that are to be hidden?
    Which is which for
    -EJB 2.1 ?
    -EJB 3.x ?
    - is EJB 3.x reverse compatible in that it allows use of the javax.ejb.* interfaces,
    and would accept a EJB 2.1 approach, or does it force one to use Annotations
    exclusively?
    Edited by: Zac1234 on Jul 21, 2010 5:21 PM

    muiajc wrote:
    I know this is a simple question, but I can't search for the answer to this because it involves syntax that Google and the like don't seem to search for..
    I am trying to figure out some Java code that I have found. I would like to know what:
    a[--i] and a[++j] mean.
    It mean increase/decrease the int i/j by 1. This is done before it gets you the value of a[]. for example if i=5 and you said a[--i] it is really a[4] and i is now equal to 4;

  • Syntax error: annotations are only available if source level is 5.0

    In eclipse, I am trying a hello world JMS tutorial.
    In the code below, it doesn't like the @ sign for some reason... And I don't know how to make it happy....
    It give this error:
    Syntax error: annotations are only available if source level is 5.0
    --------------code------------
    public class MessageSender {
       @Resource(mappedName = "jms/GlassFishBookConnectionFactory")
       private static ConnectionFactory connectionFactory;
    Here is my path if that helps.
    Path=C:\oracle\product\10.2.0\client_1\bin;C:\Program Files (x86)\Java\jre8\bin;c:\glassfish4\glassfish\bin;C:\Program Files (x86)\Java\jdk1.8.0\bin
    Thanks for any leads!
    Jim

    It give this error:
    Syntax error: annotations are only available if source level is 5.0
    That exception is telling you that the java compiler version being used to compile your java source is not 5.0 or later.
    Eclipse uses 'some' version of Java to run itself. And, by default, your java code will use that same version of java unless you configure it to use a different version.
    http://wiki.eclipse.org/Eclipse.ini#Specifying_the_JVM
    One of the most recommended options to use is to specify a specific JVM for Eclipse to run on. Doing this ensures that you are absolutely certain which JVM Eclipse will run in and insulates you from system changes that can alter the "default" JVM for your system. Many a user has been tripped up because they thought they knew what JVM would be used by default, but they thought wrong. eclipse.ini lets you be CERTAIN.
    Check the version of java that eclipse is using. Just because that version of java is not on your path doesn't mean eclipse isn't using it.
    Then repost your question in an eclipse forum.

Maybe you are looking for

  • More versatile print module

    I'd like to have a more versatile print module to realise composition with one or many pictures. It could also be nice to include more border options like in the mogrify plug in.

  • LOV query is invalid, a display and a return value are needed

    hello - i am having this issue and can't get around this when creating a popup LOV based on sql. below is LOV query. as you see the view has only two columns. I tried various ways by giving alias to columns in query but nothing works. What did I miss

  • How to close old process orders dated 2006?

    I have a open process order dated back to 2006. There is a negative balance of -$100 on this order. Now in 2010 i want to close this order. The status of this order is TECO. However when i want to close this order, the system says i need to settle th

  • Using 10g client across network

    I have my 10g database installed on a SuSE 10.0 box and everything seems to work as expected there. I configured the database to permit remote access to the web administration interface, then opened the firewall to permit http on port 8080. I can now

  • E50 reboots itself

    I've had E50 now for 3 weeks and having few problems with it. 1) The phone is rebooting itself without any reason, usually during an ongoing call but sometimes also when I'm not using it. This happens almost every day. It seems that it is not a total