Very simple question about declaring variables

if a create a new ' int ' as in the code below :
static int counter;
does the value of counter automatically default to ' 0 ' ?
Does this also apply if i declare the var to be public, protected etc ( but not final )
thanks

Most languages will initialise an int to 0 if no value is specified but it is dangerous to rely on this as it is not always the case. It is therefore recommended as good practice that you always initialise your own variables to ensure they start with the value you wish and not something unexpected.
Mark.

Similar Messages

  • Very simple question about webapp list layout.

    Hi Everyone!
    I am having a very simple issue. I have created a web app and it has a default list layout looks like:
    <table><tbody><tr><td>{tag_counter}. {tag_name}</td></tr></tbody></table>
    I have placed web app module (using {module_webapps,14273,a} ) in one of my page. In front-end it has show every thing fine except it shows table tag for each item:
    <table>
        <tbody>
            <tr>
                <td>1. <a href="/lot/lot-101">Castlepoint Lot 101</a></td>
            </tr>
        </tbody>
    </table>
    <table>
        <tbody>
            <tr>
                <td>2. <a href="/lot/efg-lot">EFG Lot</a></td>
            </tr>
        </tbody>
    </table>
    <table>
        <tbody>
            <tr>
                <td>3. <a href="/lot/some-lot">Some Lot</a></td>
            </tr>
        </tbody>
    </table>
    <table>
        <tbody>
            <tr>
                <td>4. <a href="/lot/some-other-lot">Some Other Lot</a></td>
            </tr>
        </tbody>
    </table>
    When I delete table and tbody tags from list view, it stop showing table related tags instead it start showing it without any tag.
    How to correct this issue? Please help!!!

    Here is what you can do:
    -edit the webapp list layout via FTP or via the "alpha" File Manager. The WYSIWYG editor will attempt to "correct" your HTML code. Enter something like this:
    <tr>
    <td>
    {tag_counter}. {tag_name}
    </td>
    </tr>
    -on the page you need the listing placed on enter this code:
    <table>
    <tbody>
    {webappmodule here}
    </tbody>
    </table>
    When the page renders you will get the desired result:
    <table>
    <tbody>
    <tr><td>1</td><td>Item1</td></tr>
    <tr><td>2</td><td>Item2</td></tr>
    <tr><td>3</td><td>Item3</td></tr>
    <tr><td>4</td><td>Item4</td></tr>
    </tbody>
    </table>

  • A very simple question about WF

    hi experts
    I would like to ask a question about workflow
    as u may know there is 'Loop' step in workflow, but I am confused when should I use Loop?
    Is this step used for processing internal table?  if yes, why shouldn't I create a custom BOR method and pass the entire internal table to the method?
    many thanks

    hi
    loop step for not process the internal table,
    this is used to process the some steps repetely until condition True or False.
    we have two loop steps is there
    WHILE AND UNTIL.
    Thanks
    sitaram

  • Very Simple question about JList

    Hi,
    I am newbie to Java, and I want to show a couple of items in JList Control, but it doesn't show up, anyone can help me. When I use system.out to printout the contents of the ListModel, it does tell me that those items are in it.
    Thanks a lot!!!!
    Code are like this:
    import java.lang.*;
    import javax.swing.*;
    public class listExample extends javax.swing.JApplet {
    public void init(){
    String[] data={"one", "two", "three", "four"};
    jList1=new JList(data);
    for(int i=0; i<jList1.getModel().getSize(); i++)
    System.out.println(jList1.getModel().getElementAt(i));
    public listExample() {
    initComponents();
    private void initComponents() {
    jList1 = new javax.swing.JList();
    getContentPane().add(jList1, java.awt.BorderLayout.CENTER);
    // Variables declaration - do not modify
    private javax.swing.JList jList1;
    // End of variables declaration

    The objects in your list probably don't know how to display themselves. To do this you must overload the toString method that is originally in java.lang.Object. So basically if you have an object with a String for a first name and last name, for example, you would write a toString() method that looks something like this:
    public String toString() {
    return firstName + " " + lastName;
    When you put this object in a list the JList will use the toString method automatically to place text in teh JList object.
    Hope it helps.

  • Very simple question about how to change a specific field in a table

    Hi,
    I'm working with a simple JSF web application, I have just drag a table, the "travel" standard example, and I just had 3 columns, one with a drop down list, other with a static text field and a Button.
    Then I introduced the following java code in the Button:
    public String button1_action() {
    int quantity=Integer.parseInt(dropMenu.getValue().toString());
    quantityChosen.setValue(quantity);
    When the button is pressed, I can print and check that the value obtained is the one selected in the drop down list, of the respective row.
    The problem that I would like to write it in the respective static text field (in the same row) where the button was pressed.
    What happens is that it write the value in all the column. So it reads from the write place and then write in every column?
    How to write in the respective row?
    Thanks in advance, Junkeira

    Hi,
    I'm working with a simple JSF web application, I have just drag a table, the "travel" standard example, and I just had 3 columns, one with a drop down list, other with a static text field and a Button.
    Then I introduced the following java code in the Button:
    public String button1_action() {
    int quantity=Integer.parseInt(dropMenu.getValue().toString());
    quantityChosen.setValue(quantity);
    When the button is pressed, I can print and check that the value obtained is the one selected in the drop down list, of the respective row.
    The problem that I would like to write it in the respective static text field (in the same row) where the button was pressed.
    What happens is that it write the value in all the column. So it reads from the write place and then write in every column?
    How to write in the respective row?
    Thanks in advance, Junkeira

  • Very simple question about the turtle

    I'm kind of new to java, and I'm currently working on a university project involving the wellknown java turtle. Does any of you know how to change the turtle into another thing, like replacing the drawing of the turtle with a jpeg for instance? (I am using Guzdials turtle class)
    Thanks for helping!

    georgemc wrote:
    yawmark wrote:
    georgemc wrote:
    jverd wrote:
    Either the Java turtle is not that well-known, or I'm terribly out of touch. I've never heard of it, and have no idea what you're talking about.Maybe you just forgot about it, Jeff. Like in that Arnie film "Turtle Recall"Groan. :o)Bruce Willis, Arnie and Sylvester Stallone are sat in a bar discussing their new film "The Great Composers". Bruce Willis says, "I'll play the part of Beethoven. I fancy that"
    "I think I should be cast as Mozart" says Stallone
    Arnie simply says "I'll be Bach"
    beats george about the head and shoulders with a hockey stick for bad humor ... Bad George no beer for you.
    PS.

  • Very simple question about formula EXACT

    Hi,
    i'm new to Numbers. Trying to use the 'exact' formulas.
    It's not working, so I'm reading the help section about it...
    The example is the following : =EXACT("toledo"; "toledo") should return a TRUE value.
    Numbers keeps telling me I have a syntax problem... Don't know where it is...

    Súbastien Rezzonico wrote:
    Numbers keeps telling me I have a syntax problem... Don't know where it is...
    I don't know where you are and this may be the problem.
    If you are running your program on a system using the period as the decimal separator, in Numbers the operands must de separated by commas.
    My guess is that your system uses the decimal period and that French is the 1st language in the International Pref pane.
    EXACT() is used in the English version but this one doesn't use the semi-colon in the Help or in the insert functions tool.
    It's used also in the French version which use the semi-colon in the Help and in the insert functions tool because in French (of France) the decimal separator is the comma.
    The two eastern localized versions uses EXACT() too but they assumes that the decimal separator is period so the parameters are separated by comma.
    If my guess is true, you may go to my iDisk:
    <http://idisk.mac.com/koenigyvan-Public?view=web>
    and download:
    foriWork:for_Numbers:pour_modifierNumbers.zip
    which will give you the ability to change two plist files giving you an "insert function" tool inserting functions with the comma as separator matching the fact that the system uses the decimal period.
    Yvan KOENIG (from FRANCE lundi 7 juillet 2008 18:57:39)

  • Simple question about environment variables and setting the class path???

    ok I have been trying for a few months now ontrying to set the class path..
    I work with windows vista..
    on the environment variables user variables,
    I have the name of the variable as class
    and the value as C:\Program Files\Java\jdk1.6.0_04\bin;.
    where javac is...
    on the system variables I have
    its name as class
    and the value as C:\Program Files\Java\jdk1.6.0_04\bin;.
    why is this not reading javac

    The PATH environment variable should have as an entry the directory containing your javac executable. The CLASSPATH should have have entries which define your library directories and entries which are your jar file libraries. In the early days, probably the only CLATHPATH entry you will need will be a '.' to indicate the current directory.
    The Java tutorial covers ALL of this.

  • Very Simple Question About Animated GIF Background

    Hi,
    Till now I didn't realise that I don't have to copy the whole
    picture into every frame, I can simply keep the "static" part as a
    background, and animate only the changing object (for example, some
    letters). This way the final file will be much smaller in size.
    I right-click on the selection and choose Animate Selection,
    but then I don't know how to arrange the animated selection and the
    background static picture to achieve the desireble result.
    Please advise.
    Andy

    Anna2257 wrote:
    > Hi,
    > Till now I didn't realise that I don't have to copy the
    whole picture into
    > every frame, I can simply keep the "static" part as a
    background, and animate
    > only the changing object (for example, some letters).
    This way the final file
    > will be much smaller in size.
    > I right-click on the selection and choose Animate
    Selection, but then I don't
    > know how to arrange the animated selection and the
    background static picture to
    > achieve the desireble result.
    > Please advise.
    > Andy
    >
    Seeing your PNG file would take a lot of the guesswork out of
    this, but
    basically:
    Put the static elements on one layer and choose to share that
    layer to
    frames.
    Either add your animation elements to separate frames or read
    up on
    using animation symbols.
    You can check out this list of tutorials as well, and/or post
    a link to
    your PNG file so we can be more detailed in our advice.
    http://tinyurl.com/2ljze9
    Jim Babbage - .:Community MX:. & .:Adobe Community
    Expert:.
    http://www.communityMX.com/
    CommunityMX - Free Resources:
    http://www.communitymx.com/free.cfm
    .:Adobe Community Expert for Fireworks:.
    Adobe Community Expert
    http://tinyurl.com/2a7dyp
    See my work on Flickr
    http://www.flickr.com/photos/jim_babbage/

  • This is a very simple question about multi-channel audio playback

    I have an mp4 file that i made and i made it 7.1 surround sound, and i'm pretty sure that this 7.1 surround sound works, as it can be played in VLC. i'm using netstream to load my files now. How do i make it so that flash can playback all 8-channels of sound? I suppose kglad would know the answer

    Flash doesn't support multi-channel audio (yet?)

  • Very simple question about JTextArea

    I know how to append text to JTextArea.
    textBox.append("the text to be appended")
    but how do I clear the textBox
    stev

    textArea.setText("");

  • Very simple question about DBMS_SCHEDULER jobs

    Hi,
    I have a scheduled job and its repeat interval is every 30 min for all hours.
    And also assume that my job is started at 11 am but it couldnt be completed till 11.30 am and it is finished at 11.45 am.
    What will be the scheduled execution on 11.30 am? It will start just after previous one finished?

    Create a table for testing:
    SQL> create table scheduler (starttime date, endtime date);
    Table created.
    SQL>
    Create a testing procedure:
    SQL> !cat wait_a_while.sql
    create or replace procedure wait_a_while(waittime IN int)as
      l_starttime date;
    begin
      select sysdate into l_starttime from dual;
      insert into scheduler (starttime) values(l_starttime);
      dbms_lock.sleep(waittime);
      update scheduler set endtime =(select sysdate from dual) where starttime=l_starttime;
      commit;
    end;
    SQL>
    Schedule a job every minute:
    begin
       dbms_scheduler.create_job(job_name=>'wait_a_while_job',
                                 job_type=>'PLSQL_BLOCK',
                                 job_action=>'begin
                                                martijn.wait_a_while(120);
                                              end;',
                                 start_date=>sysdate+1/(24*60),
                                 repeat_interval=>'FREQ=minutely;interval=1');
       dbms_scheduler.enable('wait_a_while_job');
       commit;
    end;
    Let this go for a while, and query the table:
    SQL> select * from scheduler order by starttime;
    STARTTIME            ENDTIME
    2013-DEC-14 14:59:59 2013-DEC-14 15:00:02
    2013-DEC-14 15:00:24 2013-DEC-14 15:01:24
    2013-DEC-14 15:33:09 2013-DEC-14 15:33:10
    2013-DEC-14 15:36:40 2013-DEC-14 15:38:40
    2013-DEC-14 15:38:40 2013-DEC-14 15:40:40
    2013-DEC-14 15:40:40 2013-DEC-14 15:42:40
    2013-DEC-14 15:42:40 2013-DEC-14 15:44:40
    2013-DEC-14 15:44:40 2013-DEC-14 15:46:40
    8 rows selected.
    SQL>
    So.....play around a little.
    But I would say that the next job waits until the first job finished.

  • !!!!!!!!!!!!!!!  Very Simple Question  about swings!!!!!!!!!!!!!!!!!!!!!!!!

    I have added two JRadioButtons to a ButtonGroup.i want to know which JRadioButton has been selected .i could not find any method which gives the state of the JRadioButton.pls advise.
    thanks

    And also:
    boolean isSelected = jRadioButton.isSelected()returns whether a specific JRadioButton was the one currently selected

  • Help!!  2 very simple questions about Tomcat 5

    1. How can I run a servlet within a package?
    * I add the package to Tomcat 5.0\webapps\servlets-examples\WEB-INF\classes
    * I add the following to Tomcat 5.0\webapps\servlets-examples\WEB-INF\web.xml
    <web-app>
    <servlet>
    <servlet-name>ServletName</servlet-name>
    <servlet-class>Package.ServletName</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name> ServletName </servlet-name>
    <url-pattern> /servlet/ServletName </url-pattern>
    </servlet-mapping>
    </web-app>
    * I type in the address line the following:
    http://localhost/servlets-examples/servlet/ServletName
    But it does not work!
    2. I can run servlets and JSP files only when they are saved inside the following packages:
    Tomcat 5.0\webapps\servlets-examples\
    Tomcat 5.0\webapps\jsp-examples\
    How can I make my own folder if I want to use Tomcat 5?
    Any answer will be appreciated. Thanks in advance!

    1. How can I run a servlet within a package?
    Define package XXX for your servlet
    For eg : package xxx;
    class ServletTest extends HttpServlet
    * I add the package to Tomcat
    5.0\webapps\servlets-examples\WEB-INF\classes
    * I add the following to Tomcat
    5.0\webapps\servlets-examples\WEB-INF\web.xml
    <web-app>
    <servlet>
    <servlet-name>ServletName</servlet-name>
    <servlet-class>Package.ServletName</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name> ServletName </servlet-name>
    <url-pattern> /servlet/ServletName
    letName </url-pattern>
    </servlet-mapping>
    </web-app>
    * I type in the address line the following:
    http://localhost/servlets-examples/servlet/ServletName
    But it does not work!
    http://localhost/servlets-examples/servlet/ServletName
    What is the error being thrown here >>> 404 not found?
    2. I can run servlets and JSP files only when they are
    saved inside the following packages:
    Tomcat 5.0\webapps\servlets-examples\
    Tomcat 5.0\webapps\jsp-examples\
    How can I make my own folder if I want to use Tomcat
    5?
    create a folder under webapps for eg :
    myfirstapp
    and follow a similar directory structure that has been followed for the example applications.Register your context with the server.xml located at tomcat\conf\server.xml
    -Regards
    manikantan

  • A very very very simple question

    Hi guys,
    I have a very simple question and standard but I cant find anywhere...
    I have two dateTime variables, i need to calculate difference between this dates in days, thats it.
    I tried all functions and tried without success a Java Embed task but I couldnt retrieve this objects as java.util.Date so I couldnt calculate exactly the difference in days like this pure java code:
    (dataVencimento.getTime() - dataReferencia.getTime()) / 86400000L)
    can you help me this?

    Hi Jose
    Just see if these alternate approaches works. I know there may be lot like this and you may be lucky to find out simple out of box solution itself. If you want to solve this issue and move ahead, gives these approaches a shot.
    1. Create a very simple standalone WebService that takes 2 input date elements (can be of Date type or String type. If string type, convert to date in your java code). Create a simple operation like getDaysBetween(firstDate, secondDate). In the generated webservice impl class, use the java code apis (refer earlier link for usage), and get the difference. Return this value. NOW, invoke this WebService in your BPEL Process, and pass your 2 inputs (if the bpel payload elemetns are date object or string objects of date), and get output, and then use this output in your continuing bpel process.
    2. This approach, I did a long back. When we insert any expression using XPath, in that editor window on bottom right side, we see many categories and for each category we see list of functions we can use, like for String, we can use concat etc. I vaguely remember reading somewhere, that we can add our own custom functions also in this section. So explore this direction and see if you can add your own function and then use that fucntion with your 2 input dates.
    I have not given solution to your problem, but may be these directions can help you move ahead. Or something along these lines.
    Thanks
    Ravi Jegga

Maybe you are looking for

  • Unable to boot from a 'successful' restore using time machine.

    My iBook took a dirt-nap and had to have serious repairs done by Apple. No problem, I have an external HD with my Time Machine back ups. However, when 'restoring from back up', I notice a few things; first, the only version that shows up is the origi

  • File permission not working in my MAC OS X

    I am working with a media company with about 40 nos oc MAC PCs (I-Mac & MacPro). Also I am having MAC OS X 10.5 SVR (ULTIMATE CLIENT) and MAC OS X Server Ver-10.5.6 loaded in it. The Server is consisting of 4 GB DDR3 RAM & 2.26 GHz Quad-Core Intel Xe

  • Add New field in OMJJ for MB1B mvt type: 303

    Hello Experts, I need your help in resolving an issue: I am tring to add a Field: "LFSNR" in OMJJ for Tcode: MB1B and Movement type: 303. but i am getting the error: "Field LFSNR is not allowed for transaction type 303" as this field doesnt exist in

  • Storing Images in a Database

    Hi Oracle Maestros, I need your help on how to store images in the database. I have requirement like that whenever i press a upload button then it should call a plsql procedure and store the image in the database. Please help me how to pass a image p

  • Print record working time

    I have configured record working time, everything looks EXCEPT there is no option to PRINT, how can we handle this , Version ep7 sp13... Thanks in Advance. Gareth