Java number question

If result is initially equal to 5, what would its value be after the following statement has executed:
result *=3;

(a *= b) is a short way of writing (a = a*b). You multiply the left side by the right side, then assign the result to the left side.
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/operators.html

Similar Messages

  • Flash/java remoting question

    Hi,
    i'm new to flash remoting and am finding using it with java
    quite troublesome. I've also found using the FileReference class
    troublesome if you use java. my question is can you somehow tie the
    remoting functionality to the FileReference.upload method
    fucntionality??
    thanks in advance

    I will use the program with photo detector to test
    the response time of the LCD screenWhy Java?I second that. With a test like that, you want to reduce the experiment down to a single variable, in this case the lcd response time. Using a java program to feed the monitor input introduces a second variable, the response time of the program. The java program's timer may not be exact, the components may not be repainted completely quickly enough, etc. If this is just for your own amusement, maybe that doesn't matter, but if you want your results to have any reliability, you'll need a more accurate and controllable input source.

  • Mysteries of Java number 32,194

    Mysteries of Java number 32,194:
    Why the class URL has methods marked "protected", even though it is itself marked "final".
    Drake

    Hey they are thinking about it... for 3 years now http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4880778
    These things take time.

  • 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!

  • One more java random number question

    which of the following codes are correct to generate a random number between start and end inclusively. Both methods seem to be working for me but im pretty sure one would be incorrect
    int num = (int)(start + (Math.random() * (end-start)));
    int num = (int)(start+1 + (Math.random() * (end-start)));

    I say neither of them work. Let's use 5 and 8 as our start and end. In the Math class, random() is said to generate a random number, x, where 0 <= x < 1.
    The first one:
    First, multiply by 8 - 5 (3).
    0 <= x < 3
    Then, add 5.
    5 <= x < 8
    Then, casting to an int, we get a number 5 - 7.
    The second one:
    First, multiply by 8 - 5 (3).
    0 <= x < 3
    Then, add 6.
    6 <= x < 9
    Then, casting to an int, we get a number 6 - 8.
    The "correct" way:
    int num = (int) (Math.random() * (end - start + 1) + start);First, multiply by 8 - 5 + 1 (4).
    0 <= x < 4
    Then, add 5.
    5 <= x < 9
    Then, casting to an int, we get a number 5 - 8.

  • Simple Java Sound Question...

    Can I draw waveforms while capturing data? If yes, how. If no, why.
    Thanks. I need the answer ASAP, please help.

    Hi nfactorial,
    Can I draw waveforms while capturing data?If you would like to do that in Java you would need to know about how to use the Java language in general and especially about the Java Sound and Java2D APIs.
    If yes, how.It would be too much to explain to answer such a general question. A general answer is, you need to use the Java Sound API to capture the data for which a waveform should be drawn. The Sound API delivers data as a stream of bytes typically encoded in pulse coded modulation (PCM) format. The data stream has digital samples each representing a level of sound pressure for a certain point in time. The stream of samples in the amplitude/time domain need to be transformed to a spectrum of samples in the amplitude/frequency domain, i.e. a number of PCM samples need to be mapped to the frequencies that should be displayed. This is done with the fast fourier transformation algorithm. Each set of amplitude/frequency values can then be displayed as a waveform by using some line drawing logic. The entire process would need to run constantly, i.e. as bytes are received from the sound data stream transformation and drawing is triggered.
    Related readings:
    Java Tutorial
    http://java.sun.com/docs/books/tutorial/
    Java Sound Documentation
    http://java.sun.com/j2se/1.5.0/docs/guide/sound/index.html
    Java Sound API Programmer's Guide
    http://java.sun.com/j2se/1.5.0/docs/guide/sound/programmer_guide/contents.html
    Java Sound Resources
    http.//www.jsresources.org
    Java 2D Graphics Tutorial
    http://java.sun.com/docs/books/tutorial/2d/index.html
    Wikipedia on fast fourier transformation
    http://en.wikipedia.org/wiki/Fast_fourier_transform
    HTH
    Ulrich

  • Simple java pgm - question

    Hallo,
    to the following pgm I had question:
    static void printPrimes (int max) (= wavy bracket;
    boolean(should be angular brackets) sieve = new booolean (angular br max+1
    angular br)
    int i,j;
    for (i=2; i = max;i++)sieve(angluarbr i angular br)= true
    i= 2
    while (i= <= max;) (=wavy bracket Out.println (i+ " "); // is prime
    for (j=i; j <= j+i) sieve(angular br j angularb.) = false;
    while (i <= maxAmpersandAmpersand !sieve (angular br angular br)I++;
    ) wavy br ) wavy br.
    I hope this is still kind of readable.
    Q's are:
    after the first "for" there is a new i=2, which seems to staty at 2 all the time; the following while does not change this value ( the beginning for i++ does not change this) and so seems to print 2 at all times (??)
    then the inner loop seems to count up all the doubbles of the new prime number and thrwoes it out as false at the end of it;
    the i values (increased with i++ seemsto refere at all times to the unit numbers and only indirect to the un it values, which are written/ assigned to it (??)
    I seem to wonder how the pgm can print out anythings else the 2's.
    I would appreciate any help to that.
    ml
    griz

    I hope this is still kind of readable.No, it's not. http://forum.java.sun.com/help.jspa?sec=formatting
    Why are you omitting the braces and brackets? And why don't you type "program"? Aren't we worth the additional time it takes?
    Q's are:
    after the first "for" there is a new i=2, which
    seems to staty at 2 all the time; the following
    while does not change this value Why should it? You don't tell it to.
    ( the beginning for
    i++ does not change this)It does. It just gets re-set to 2 after the for loop-
    and so seems to print 2 at
    all times (??)Yeah. What else?
    then the inner loop seems to count up all the
    doubbles of the new prime number and thrwoes it out
    as false at the end of it; That part is definitely unreadable.

  • Java List question

    Dear all,
    My development tool is JDev. 10.1.3.
    I've a session bean which the list contains several fields. The list defined like this:
    List<cell> List1 = new ArrayList(); cell in a cell.java.
    I created List2, List<cell> List2 = new ArrayList(); which the list contents are copied from List1.
    On the jspx, List1 is on the left hand side, it rendered out as a table, user can select the row and click the button "Add item to List2". On the right hand side, List2 allows user input information. User can choose List1 item to List2 repeatly.
    The question is, e.g. List1 and List2 contain A and B items initially. User inputted information in List2 for A item. And then, choose A item from List1 to List2 again. The new selected item carried the information that user input in List2 before.... I don't know why?
    Then, I modified the List2 like this: List<dupcell> List2 = new ArrayList(); and hope the information will not be carried.
    However, it doesn't work..
    Can anyone help me? Please.
    Thanks for any suggeston!
    Regards.

    Sorry, my English is not good...
    my situation like this:
    "List1" defined in a session bean, "shoppingCart.java", like this:
    List<cell> List1 = new ArrayList();
    In the cell.java code, like this:
    public class cell {
    private String id;
    private String type;
    private Number quantity;
    private String remarks;
    public cell() {}
    public cell(Number id) {
    this.Id = id;
    /** defined getter and setter **/
    In a JSF page1, user selected the id and id will be stored in the session bean. e.g. user selected id "A" and "B".
    Then, user click a button and go to JSF page2.
    This button call a function, the List1 copy to List2, like this:
    public String copy_to_new(){
    List2.addAll(Utils.getShoppingCart().getList1());
    return "page2"; //go to JSF page2
    Two lists were created.
    List1 - user select item, move the item to List2.
    List2 - user input the information: type, quantity and remarks. e.g. user inputted information for id "A": type = "small", quantity = 1, remarks = "urgent".
    Now, user click id "A" from List1 to List2.
    On List2, it shows:
    Id Type Quantity Remarks
    A small 1 urgent
    B
    A small 1 urgent <-- new selected row (I don't want this)
    Question: How can I create a new row that it does not carry the previous information, like this:
    Id Type Quantity Remarks
    A small 1 urgent
    B
    A <-- new selected row
    Thank you very much for any helps!!
    Regards.

  • SMS sending from Java Application - Questions & Help

    Hi all.
    I�ld need to develop a Java App. (migth be a descktop or a Servlet based web app.) wich must send around 3000 SMS in a massive way. My problem is basically the restrictions to obtain a gateway "short code/number" from a SMSC provider (the providers in Argentina are very monopolics and prevents such kind of servicess) so, it is very difficult to send SMS messages using http connections wich is the best way from the java perspective, I think.
    Could somebody tell me about alternative ways to solve this limitation?. Any additional suggest about learning materials will be appreciate also.
    Regards.

    Hi, I�m here again.......
    Nobody interested in help me?. I think my question isn�t pointed to a J2ME Gur�. It�s only for Java people interested in help Java people.......Please!!!

  • 'unbounded' java factorial question

    during a recent job interview I was given a java assessment test and asked to write a code fragment to calculate factorials.
    The tech lead then walked through the code with me and questioned how I would write the fragment
    'unbounded' by an int, long or double type.
    He mentioned the phrase 'max value' somewhere, but I don't understand the solution he was looking for.
    do any java gurus understand the question? can you provide a code fragment that meets this requirement?
    I've seen the typical code samples using an int type as the input number.
    Thanks in advance for your help.

    user13537476 wrote:
    during a recent job interview I was given a java assessment test and asked to write a code fragment to calculate factorials.
    The tech lead then walked through the code with me and questioned how I would write the fragment
    'unbounded' by an int, long or double type.
    He mentioned the phrase 'max value' somewhere, but I don't understand the solution he was looking for.He was probably asking what you would do if the result were bigger than Integer.MAX_VALUE, Long.MAX_VALUE, etc. Factorial grows very fast, so even a modest input can have a result that's too large to fit in those types.
    do any java gurus understand the question? can you provide a code fragment that meets this requirement?I can't speak to what the interviewer was looking for, but if it were me, I'd use BigInteger.
    I've seen the typical code samples using an int type as the input number.That would be sufficient to show the general approach, whether iterative or recursive, but it will only work for small values. If I recall, 12! is the largest factorial value that will fit into an int. You can use the same approach with BigInteger.

  • Plzzz write prog to this simple java threads question

    Write a program in C to create four processes. The original processes creates
    two children before it prints out "PARENT". The children processes print
    "CHILD1" and "CHILD2" respectively. The first child process creates a child
    process that prints out "GRANDCHILD".
    Note: The output must be guaranteed to print out in the following order each
    time it is executed:
    GRANDCHILD
    CHILD2
    CHILD1
    PARENT
    a. Write the program using C or C++ and forks to create the children processes.
    b. Write a second program using Java and Threads for the children processes.
    The output statements for CHILD1, CHILD2 and GRANDCHILD must come from print
    statements in the run method of the thread.

    Most people here will not do your homework for you. If you post a reasonable question that shows you've made some effort, and what the results of that effort were, and provides details about what parts you're having trouble with, then somebody will probably provide guidance so that [you can complete the work.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Simple Java Coding Question

    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.
    My first thought was that they meant to look at the position in the array one less (or more) than i (j). But that doesn't seem to be the case. A is an array of Strings, if that matters...
    Thanks for you help.

    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;

  • 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;

  • A few Online Number Questions

    First of all, I live in Canada and it doesn't appear that I can get a Canadian online number.  Any idea when that will become available?
    Also, is there any way to change the Call Display feature to display not only a business name, but also a number that is DIFFERENT than the online number.  As I cannot get a Canadian online number, I would need the call display to read my business name, and then the local Canadian phone number that I would like people to call (so they avoid long distance charges).
    Any help you could provide would be apprecaited.
    KC

    I have a similar question.
    Any idea if Online Numbers might be available for India ? Any timeline as of now ?

  • Importing Java Class Question

    Hello,
    Sorry for such a newbie question and such a long post, I did remember how to do this before but now I can't for the life of me remember. Anyhow, I have a simple question about importing custom-made java classes, from another directory in the windows operating system. I have the classpath set, and also I realize that because the two files below are in the same directory theres no need for an import statement as Java will look for the class in the same directory.
    But I would like to know how the import statement is suppose to look to import a custom made java class from another directory, (assuming of course that I set the correct classpath)
    here's the java class location:
    c:\school\csc365\narcus.java
    //narcus.java
    import java.io.*;
    class narcus implements Comparable
    String firstName = "firstName";
    String lastName = "lastName";
         public narcus()
         firstName = firstName;
         lastName = lastName;
         public narcus(String f)
         firstName = f;
         lastName = lastName;
         public narcus(String f, String l)
         firstName = f;
         lastName = l;
    public String getFirst()
    return "first..";
         public int compareTo(Object e)
         return 1;
    Here's the location of the driver program thats suppose to use the narcus.java class
    c:\school\csc365\test.java
    //test.java
    //import statement? maybe import "c:\\school\\csc365\\*"; ?
    import java.io.*;
    class test
    public static void main(String[] args)
         narcus jim = new narcus();
         System.out.println("omg\n");
         System.out.println(jim.getFirst());
    And also, here is my classpath:
    PATH=c:\school\csc365\;c:\school\
    The classpath also points to the jdk libraries and few other directories but I didn't write that above, as it probably isn't relevant.
    I've tried the following import statements.
    import "c:\\school\csc365\\narcus.java";
    import "narcus.java";
    import "c:\\school\\csc365\\*";
    But I keep getting an error that says:
    test.java:1 <identifier> expected
    Any help is appreciated!

    Hi Folks,
    I am new to this forum, heard that interesting discussions always happens on this forum so immediately registered,don't want to miss any oppurtunity to participate in discussions.
    I have pretty much basic question regarding compiling and exceuting files in different packages.I have the following directory structure
    C:\Projects\WDPROEast\Development\CommonService\Code\Java from where java files stored in different packages as follows:
    com\wdpro\commerce\common\crm\dae\nautilus\adapter directory has java files in com.wdpro.commerce.coomon.crm.dae.nautilus.adapter package.
    com\wdpro\commerce\common\dae\exception has java files with package named com.wdpro.commerce.common.dae.exception.
    com\wdpro\commerce\common\dls\exception has java files with corresponding package name.
    com\wdpro\commerce\common\dto has java files under proper package name.
    com\wdpro\commerce\common\exception has java files with appropriate package name.
    com\wdpro\commerce\common\util has java files with package name. I am starting at Java Directory,want to compile and run file named a.java in com.wdpro.commerce.coomon.crm.dae.nautilus.adapter package with having all other java files on classpath as follows
    so I issued command for compilation as follows C:\Projects\WDPROEast\Development\CommonService\Code\Java>javac com/wdpro/commerce/common/crm/dae/nautilus/ada
    pter/a.java com/wdpro/commerce/common/crm/dae/nautilus/adapter/NautilusServiceUtility.java com/wdp
    ro/commerce/common/crm/dae/nautilus/adapter/URLReader.java com/wdpro/commerce/common/crm/dae/nautilus/adapter/
    b.java com/wdpro/commerce/common/dae/exception/*.java com/wdpro/commerce/common/dto/*.java
    com/wdpro/commerce/common/exception/*.java com/wdpro/commerce/common/util/*.java com/wdpro/commerce/common/dl
    s/exception/*.java It compiled greatly but when I issue command to run a.class file as
    C:\Projects\WDPROEast\Development\CommonService\Code\Java>java com/wdpro/commerce/common/crm/dae/nautilus/adap
    ter/UtilityAccesssit's giving following exception
    Exception in thread "main" java.lang.NoClassDefFoundError: com/wdpro/commerce/common/crm/dae/nautilus/adapter/
    UtilityAccesssbut when I run a.java with the following command
    C:\Projects\WDPROEast\Development\CommonService\Code\Java>java com/wdpro/commerce/common/crm/dae/nautilus/adap
    ter/UtilityAccess com/wdpro/commerce/common/crm/dae/nautilus/adapter/NautilusServiceUtility.java com/wdpro/com
    merce/common/crm/dae/nautilus/adapter/URLReader.java com/wdpro/commerce/common/crm/dae/nautilus/adapter/Nautil
    usAccessUtility.java com/wdpro/commerce/common/dae/exception/*.java com/wdpro/commerce/common/dto/*.java com/w
    dpro/commerce/common/exception/*.java com/wdpro/commerce/common/util/*.java com/wdpro/commerce/common/dls/exce
    ption/*.javaSo my question do I need to add all required java files to path when required class files are under different packages?is it manadatory.
    I hope you understand my question,pass me any comments you may have.
    Thanks alot,
    Anu

Maybe you are looking for

  • How to connect to a Remote Oracle Database

    Hi Friends, The error I encountered while connecting to a remote database is ���DataSource name is too long String url="jdbc:odbc://abc:1523/test"; con = DriverManager.getConnection(url,"xyz","xyz1"); Here Remote Host-name = abc Port = 1523 DataSourc

  • VI Search Path not working in LV2011 for VI Server Plug-ins with exe

    I have found what seems to be a problem with the search path when a LabVIEW 2011 built executable calls a Plug-in VI.  When the plug-in VI has subVI’s from vi.lib on its diagram the executable has to know where to find them.  Not all VI’s in vi.lib a

  • Reminders will not sync from iphone 4s to iPad 2 .. ???

    EVerything else in iCloud seems to work, but I don't see reminders on my iMac, or on the non-originating device. I have an iMac, iPad 2 and iphone 4s ... Please help!!!

  • Seeburger AS2 Adapter - How to extract copy of file sent out ?

    Hi Experts, The scenario is SAP R/3 sends idoc to PI.  PI converts this into a flat file and sends to Trading Partner through Seeburger AS2 adapter. We can trace the message content in XML format within PI using SXMB_MONI or RWB.   How to extract a c

  • Does iMac 2009 A1224 support DDR3 1333MHz Ram or not?

    Hi, I got lucky and came across a free set of 4GB 2Rx8 PC3-10600S-09-11-F3 Ram. My question is, if an iMac model A1224 supports 1333MHz or not? Any help greatly appreciated Cheers