Java gurus -- look here please

Is the integer -1 of type int or is it an union between an operand (-) and a positive number?

Compile this class. Command: javac Test116.java
class Test116 {
    public static void main(String[] args) {
        int x = -1;
}Use javap to disassemble the class.
C> javap -c -classpath . Test116
Compiled from Test116.java
class Test116 extends java.lang.Object {
    Test116();
    public static void main(java.lang.String[]);
Method Test116()
   0 aload_0
   1 invokespecial #1 <Method java.lang.Object()>
   4 return
Method void main(java.lang.String[])
   0 iconst_m1
   1 istore_1
   2 returnYou can see that the "main" method is composed from three instructions:
iconst_m1 -> it pushes the constant "-1" to the stack
istore_1 -> pops the top of the stack and stores it into the first local variable (x)
return -> return from the method.
So you can say that "-1" was translated into the constant "- 1".
But the compiler is smarter: try this program:
class Test116 {
    public static void main(String[] args) {
        int x = 9 - 10;
}9 - 10 is equal to -1. Use Javap and see that the output is exactly the same.

Similar Messages

  • Java gits -- look here please

    How do I convert a .class file to an .exe file using the Date class which extends an interface that doesn't have a classpath?

    What are you going on about? It makes perfect sense to a git.But not if you understand Java.
    How do I convert a .class file to an .exe file There are many examples on google.
    http://www.google.co.uk/search?num=20&hl=en&ie=UTF-8&c2coff=1&q=exe+java&btnG=Search&meta=
    using the Date class The Date class is a standard class so is always available.
    which extends an interface that doesn't have a classpath?Interfaces do not define a classpath. Thus this is always the case.
    When you convert from .class to .exe you only need to have all your classes/interfaces at this point. Once it is a .exe none of these are required.

  • Java execution failed.  Please check the Java Option in the option dialog.

    I recently installed BI Publisher MS Word Add-In.
    After installing I get the error "Java execution failed. Please check the Java Option in the option dialog" when trying to preview a template in (pdf, word, excel...).
    I tried changing a java parameter as suggested by the following thread but it did not get past the error.
    Java execution failed.  Please check the Java Option in the option dialog.
    Here are my settings to the Word Add-In under "Oracle Bi Publisher > Options... > Preview (tab)
    Java Home = C:\Program Files\Java\jre6
    Java Option = -Xmx512M
    Any help would be appreciated.
    Todd

    Is there a log I can see more about this Java error? I've looked for a log but can't see one.
    TIA,
    Todd

  • I can't open ibooks. There was a screen pop up about java se. Help please.

    I can't open ibooks. There was a screen pop up about java se. Help please.

    Hi there ajsupprt,
    It sounds like you may need to update the version of Java installed on your computer. Take a look at the article below for more information.
    Java updates available for OS X on August 28, 2013
    http://support.apple.com/kb/ht5648
    -Griff W.

  • How do i invoke Windows APIs in JAVA??? Please help.

    Is there a way to invoke Windows APIs in Java??? Please help......Thankx

    Short answer, you don't. However, you should look at Java Native Interface (JNI) very closely. It will allow you to wrap the Win32 API calls so that Java can call your wrapper methods. Another side to it, although not necessarily related to your question is a JavaBeans to COM bridge that you may want to look into as well, though it's probably not going to be a solution for what you're wanting to do right now.

  • Hello, I bought my iphone in japan. And now I'm in Brazil and I use it here, I need the unlock code for me to use here. please

    Hello, I bought my iphone in japan. And now I'm in Brazil and I use it here, I need the unlock code for me to use here. please

    williamjapa wrote:
    Hello, I bought my iphone in japan. And now I'm in Brazil and I use it here, I need the unlock code for me to use here. please
    Only the carrier to which the phone is locked can authorize an unlock. None of the Japanese carriers will do that. Sell the phone and buy one that works in Brazil.

  • Can not see training videos - message "We can't find the page you are looking for, please return to the Apple Support homepage?

    Can not open Training Videos shown on Apple Site - message comes us " we can not find the page you are looking for - please return to the main Apple Site"? Help

    You've used the wrong name for the folder that holds the html page.
    http://web.mac.com/artworksforyouth/iWeb/Site/Home.html
    Is what it is trying to find (and it doesn't exist).
    www.artworksforyouth.org redirects to www.artworksforyouth.com which then redirects to your iWeb page.
    Rather than the word "Site" in your URL you need to use ArtWorks%20for%20Youth

  • Can I post here(Acrobat Windows) Java Script questions here?

    Hello
    Can I post here(Acrobat Windows) Java Script questions here? If not, wht is the correct forum?
    THank you

    Back up and down to Acrobat Scripting. Bot Windows and MacIntosh Acrobat versions use the same JavaScript.
    If you are using LIVECYCLE DESIGNER use their forums. The JavaScript syntax and objects are different in LIVECYCLE DESIGNER!

  • Which program did they use here , please?

    hi ,
    could you tell me which program did they use here , please?
    http://www.flashcomponents.net/component/flash_clouds_animation.html
    and this one
    http://www.revivedwire.com/products/Moving_Clouds/ 
    i want to do a similar one for a webpage
    thanks in advance

    Most likely it was actual time lapse video footage that someone shot of clouds. From there, it was converted to flash video and is sold as stock video.
    good luck,
    elaine

  • URGENT!!! Java Gurus Please Help with adf issue!

    PLEASE SEE MY LATEST POST BELOW TIMO'S RESPONSE. THE REQUIREMENT HAS CHANGED. THAT IS THE ISSUE I AM LOOKING A SOLUTION FOR.
    Hello All,
    We have a requirement where our adf/jsf app needs to pick an EXCEL file from the server where the application is deployed. The sequence is :
    User comes to the page
    Clicks on "Open EXCEL" button
    EXCEL file located in the c:/ of the server opens up.
    How can this be done? I do not see any coding needed because the EXCEL file is being opened as is (and after user views it he closes the file) and the data is not being transferred to the jspx page.
    *We are totally flexible in how this is implemented - ie, using button, link , html etc etc. What ever works!!!!*
    Thanks,
    Edited by: user12054715 on Aug 17, 2010 8:54 PM
    Edited by: user12054715 on Aug 18, 2010 4:11 PM
    Edited by: user12054715 on Aug 18, 2010 4:13 PM

    Hello Timo,
    I am using 10.1.3g so your response is not going to help me.
    However, I have another question that I have already posted on the Forum. Please help me...
    Requirement:
    *1. Java application should be able to write "Hello World" in the excel file, when the user opens it.*
    I CAN DO THIS WITH THE FOLLOWING CODE:
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet("newSheet");
    HSSFRow row = sheet.createRow(1);
    row.createCell(1).setCellValue("HelloWorld!!!!!!!!!");
    *2. A "Write To Excel" button on jsf page opens a dialog asking user to Save or Open the excel file. (user can save the file anywhere on his machine)*
    I CAN DO THIS WITH THE FOLLOWING CODE:
    In jsf:
    <af:commandButton text="Download" action="#{myBackingBean.writeToExcel}" useWindow="true"/>
    In backing bean:
    public static void writeToExcel() throws IOException
    String filename = "workbook.xls";
    // //Setup the output
    String contentType = "application/vnd.ms-excel";
    FacesContext fc = FacesContext.getCurrentInstance();
    HttpServletResponse response = (HttpServletResponse)fc.getExternalContext().getResponse();
    response.setHeader("Content-disposition", "attachment; filename=" + filename);
    response.setContentType(contentType);
    PrintWriter out = response.getWriter();
    BOTTLENECK: When the user opens the excel how do I show "HelloWorld!!!!!!!!!" ?

  • Java Gurus  please  help

    i have to buid a screen saver with my companys logo on it which is a flash file any idea how i can do that
    Thanks in advance

    so you tell me how do i create it !! Iam familiar with java thats why i thought so please tell me how to craete

  • All u java gurus -please help me with my DAEMONS

    I had already posted one query regarding the same but due to some unsatisfactory answers I am forced to ask the same question.
    JUST TELL ME HOW TO WRITE DAEMONS IN JAVA- REST I WILL MANAGE
    heres my problem:
    I have to make a java program to backup and restore encrypted files over a network.
    The daemon should :
    1 . The daemon has to be able to send messages to all other comps in the network that a user on some machine wants to backup or restore a file.
    2. It also needs to be able to find all the files backed up of others as well as my own files on my PC.
    3. I will maintain files placed on each PC using hash tables for efficient searching.When this is done the daemon will figure out from a heap of free disk space how many comps are to be involved.I then use a TCPserver or TCPclient class to open connections to them and send or receive encrypted files.
    4. Daemon will send messages across the network if any system change(disk space +/-) occurs.Can anyone give me some documentation and links on the same?
    Yeah,one more thing how will that daemon calculate free disk space on my computer -any methods would be appeciated -This willl determine what computers to select for back up.
    IF all the above doesnt make any sense just tell me how to write a daemon-I need the code for this.
    Also how will ensure that my daemon will run at the same time a machine boots up.
    help for any part will be appreciated

    Check out the apache commons daemon library and associated stub program. http://jakarta.apache.org/commons/daemon/
    AFAIK There's no quick way in the Java libraries of measuring free disk space. Best bet is to exec the appropriate command line utility and read the results programatically.

  • Please look here

    What are the best web sites to get music off of. My friend's iPod got music off of somewhere and it damaged her computer. What are the best sites to go to? I dunno if this exactly belongs here, but please answer.
    Thanks, signed the newbie
    Miza( this is my nickname. I mean, who would name their kid Miza??? lol! )

    www.play.com, www.amazon.com are pretty good.

  • Please take a look here: a lot of picture's from the Mac Pro and Upgrades.

    Just like any other Mac Pro owner, i'am really happy with it!
    Please take a look at my site: http://mac.powerbras.nl
    This is the first site i have ever made (on a Mac) so i hope you will like it!
    Before i had my Mac Pro i would really like too see a little more from the inside. But there where just a few site's with some small pictures. Now i made this site with some high resolution pictures so everyone can see the inside off the Mac Pro and how perfect it is!
    Also you can find the Xbench results from my configuration and all the Apple System Profiler specifications
    Please take a look, you will like it. Especially when you have no Mac Pro!

    Anne,
    Great job on the site.
    There are a number of third party templates available for iWeb that, with some creativity, can yield a site that looks nothing like the template-based norm. An example of one such site, "The Camera Obscura", a site created in iWeb and hosted on .Mac, demonstrates very well the limitless capabilities of iWeb. Some post-publishing html editing has been done on Obscura, but is easily accomplished with the right tools.
    Additional iWeb templates and other tools that support this great application can be found in The iWeb Tool Chest.
    Keep up the great work on your site!
    Mark

  • Please take look here....somebody!!!

    I have one textfield and one combobox and a button. When the button is pushed, if there is textfield is blank and the combobox is set to "Make a Selectio.." I want to see a JOption message. Here is what I have but my combobox is not working. I get a compile time error. I think I need to declare "getSelectionItem" somewhere but where and how......, that I don't know.
    if (source == DataFind)
    try
    //Create Statement object
    Statement s = c.createStatement();
    String query = "SELECT * FROM Data";
    if (txtName.getText().trim().equals("") &&
    txtID.getText().trim().equals("") &&
    cmbColor.getSelectedItem.equals("Make a Selection....."))
    JOptionPane.showMessageDialog(null, "You must ....!", "Error", JOptionPane.ERROR_MESSAGE);
    else
    String Name = "WHERE Name = '" + txtName.getText() + "'";
    //Create the ResultSet object
    ResultSet result = s.executeQuery(query);
    char Color;
    int ID;
    while (result.next())
    Name = result.getString(1);
    Color = result.getString(2).charAt(0);
    ID = result.getInt(3);
    output.setText(Name + " " + Color + " " + ID);
    }

    Already replied getSelectedItem()

Maybe you are looking for

  • Iphone voice memos does not stay open

    iphone voice memos does not stay open

  • Oracle BI Server crashed?

    Hi all, I've had a really disturbing issue with OBISE1 today which i hope you guys can shed some light on. During an OBI demonstration the performance went down the drain after about 30 minutes. While i was logged in and demonstrated dashboards/repor

  • ICloud Mail: Alias cannot be saved

    When I logged in on iCloud.com (also on my iPod Touch) my mail aliases have been disappeared! And that happens now that I wanted to switch to iCloud as mail service. Then I tried to create a new one, doesn't matter what I fill in, what label color I

  • Error in abobe forms

    Hi all When i'm trying to select layout in abobe form, its shows following error occured "Error occurred in communication with layout editor" Anyone help me how to solve this issue?

  • AC3 encoding?

    Does iDVD '08 finally add Dolby AC3 audio encoding?