Simple basic java question

public static void main(String[] args)
..anyone know the statement as above could be start at begining , so what is the (String[ ] args) mean in java ?
in my ideas of this statement is
publc : indicates the statemean can be used as all class , this is open for public use
static mean the main method can used as class method
void indicate that the statement return nothing
main indicate any class should be run this first.
so my question what is the function of (String [ ] args) ? // one string array call args ?

String[] args is indeed an array of Strings called args. The reason it's there is to collect any arguments passed to your code when you start it.
eg. if you have a class called TestClass and you called it from the command line like this:
java TestClass exam tomorrow oh shite
.......then the args array would hold the four Strings:
exam
tomorrow
oh
shite

Similar Messages

  • 4 basic java questions..

    ok so I already learned Java last year (in grade 11), but my teacher didn't really teach anything, we learnt everything by ourselves from the API... so theres a lot of things I actually don't understand, but for now I want to ask 4 basic questions:
    1. What does static mean?
    2. Why would u "final" a constant variable? ie. If you have a variable called SIZE which is set to 5, so if u want it to be a constant, just never change its value. But what does the keyword final do to it?
    3. What's super? I see it sometimes, and my teacher showed us in the applet exampls to use super.paint(g) or somethign like that for the paint method, but I never use that because I noticed it works fine without it..
    4. Whats a question mark? I saw a game that was made in java and it had a lot of places where it had a question mark , which was part of the syntax. For example,
    int j1 = i != 0 ? i - 1 : 199;
    OR
    JUMPVEL = (fSuperSlime) ? 65 : 31;
    I really don't understand these lines...
    feel free to answer any of these questions...

    wow cool...thanks.. that question mark thing is nice
    saves a few lines..
    now, about super, so u mean u can access the parent
    class's variables?Variables, methods, constructors, if the access level is such that it's allowed.
    This will be covered in any tutorial or text though.
    Sun's basic Java tutorial
    Sun's New To Java Center. Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    http://javaalmanac.com. A couple dozen code examples that supplement The Java Developers Almanac.
    jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    Bruce Eckel's Thinking in Java (Available online.)
    Joshua Bloch's Effective Java
    Bert Bates and Kathy Sierra's Head First Java.
    James Gosling's The Java Programming Language. Gosling is
    the creator of Java. It doesn't get much more authoratative than this.

  • Basic Java questions

    Hi.. I just joined a new company, they have developed a Java software. They have a few Sun Java Server with Tomcat, Silversteam, oracle. And their application are run on Java Web Start.
    I want to learn more about Java in order to manage the server, but I have very little knowledge of it
    1)What is the difference between Java Run Environment or Java Web Start??
    2)When I can't access my HSBC internet banking, they told me I need to download the new Java? Is that JRE? What does it do to my computer?
    3)What is the difference btw the Tomcat and Silversteam ?? Can Tomcat be installed in W2K server?
    4)We can create a Jar file from the Jar class? What is Jar Class then? How to create a sample program that can be start from JWS??

    Hi.. I just joined a new company, they have developed
    a Java software. They have a few Sun Java Server with
    Tomcat, Silversteam, oracle. And their application
    are run on Java Web Start.
    I want to learn more about Java in order to manage the
    server, but I have very little knowledge of it
    1)What is the difference between Java Run Environment
    or Java Web Start?? Java Web Start is a tool that lets you manage start remote Java apps.
    The Java Runtime Environment (JRE) is the interpreter through which all Java code is executed.
    2)When I can't access my HSBC internet banking, they
    told me I need to download the new Java? Is that JRE?
    What does it do to my computer?You have to download the JRE or the Java plug-in for your browser. It does nothing special to your computer - it's just another application or plugin.
    >
    3)What is the difference btw the Tomcat and
    Silversteam ?? Can Tomcat be installed in W2K server?
    I don't know Silverstram. Tomcat is a web server written in Java.
    It can run on any Java-enabled platform (i.e. any platform having the JRE installed).
    4)We can create a Jar file from the Jar class? You can create a Jar using the jar tool or any zipping program, Winzip etc...
    A Jar file is basically a zipped file.
    What is Jar Class then?Whatever a "Jar class" is (which I don't know) it has nothing to do with the Jar files.
    How to create a sample program
    that can be start from JWS??Create a remote application.
    You need to check some documentation and some good books.

  • Some basic java Questions

    class overload
    void test (long a)
    System.out.print("\n\t\t Inside Integer..."+a);
    class usetest
    public static void main(String args[])
    overload ob=new overload();
    double i=88;
    int j=54;
    //ob.test(i); this do not work
    ob.test(j); // works
    The one that do not work when typecasted works why? When method having same parameter is not present what java compiler do?

    The compiler will automatically perform a "widening" cast for you, i.e.
    a cast from one type to another where no precision is lost. If you supply
    an int and a long is wanted, the int will be cast to a long type.
    Not so from double to long because that isn't a widening cast, it's a
    "narrowing" cast because bits might get lost after casting. You have
    to cast that double to a long explicitly, thereby telling the compiler that
    you know what you're doing.
    kind regards,
    Jos

  • Simple collapsible panels question...

    (Thought I'd give this forum a try. The other discussion
    category gets no traffic! It seems this is where the action is.)
    I'm putting collapsible panels on the left side of web page
    to be used as a sort of menu list that links to the rest of the
    website. Some "tab" sections will have stuff in its associated
    "content" section, namely some text that will link to other parts
    of the website. Other "tab" sections will have nothing in its
    "content" section, but I want to use the text in these tabs to be a
    link. In other words, I have no use of the content section for
    these tabs. I did a quick test and made the text in a tab to link
    to another page, but it didn't do anything (though the "content"
    section links of other tabs worked fine). Should I simply delete
    this part: <div class="CollapsiblePanelContent"></div>
    Here's an example of the web page, though it is still very
    much under construction, and no links put in place yet in any of
    the "tab" sections of the collapsible panels:
    http://www.freywine.com/NewSiteExamples/index4.html
    (I just want you to see how I'm using the collapsible panels, and
    how the "Home" and "Order Here," for example, will have no text in
    their "content" sections of the collapsible panels. Naturally, the
    parts with the downward pointing triangle will have text with links
    in their "content" sections.)
    Basically, the question is: what's the best way to have the
    tab section be just a link and the content section to not be there
    at all. I suppose I could simply not use collapsible panel code,
    but then I would have to figure out how to fit a non-collapsible
    panel div to fit right snug between all the collapsible panels (I'm
    still very much a newbie with CSS).
    Any simple way to deal with this?
    I've attached the complete collapsible panel code for the one
    which has the tab text as a link and nothing in the content area.
    Thanks for the help!
    <div id="CollapsiblePanel2" class="CollapsiblePanel">
    <div class="CollapsiblePanelTab" tabindex="0"><a
    href="
    http://freywine.stores.yahoo.net/">Order
    Here</a></div>
    <div class="CollapsiblePanelContent"></div>
    </div>

    Youre on the right lines. Just rip all of the collapsible
    stuff out
    which surrounds the actual link, as shown in the code below.
    The code shows the 'Home' and the 'Order Here' <divs>
    as your code
    should be, plus the opening collapsible <div> of the
    'Wine' tab.
    Note the 'combined' css classes 'CollapsiblePaneltab' and
    'CollapsiblePanel'(leave a gap between them as shown) The
    reason for
    this is the brown bar to the left of the tab takes its
    properties from
    the 'CollapsiblePanelTab' css PLUS you need to add some
    inline left
    padding to get the link to line up under one another.
    <div id="sidebar1">
    <div class="CollapsiblePanelTab CollapsiblePanel"
    style="padding-left: 7px"><a href="
    http://www.bbc.co.uk">Home</a></div>
    <div class="CollapsiblePanelTab CollapsiblePanel"
    style="padding-left: 7px"><a href="
    http://www.bbc.co.uk">Order
    Here</a></div>
    <div id="CollapsiblePanel3" class="CollapsiblePanel">
    brainfillet wrote:
    > (Thought I'd give this forum a try. The other discussion
    category gets no
    > traffic! It seems this is where the action is.)
    >
    > I'm putting collapsible panels on the left side of web
    page to be used as a
    > sort of menu list that links to the rest of the website.
    Some "tab" sections
    > will have stuff in its associated "content" section,
    namely some text that will
    > link to other parts of the website. Other "tab" sections
    will have nothing in
    > its "content" section, but I want to use the text in
    these tabs to be a link.
    > In other words, I have no use of the content section for
    these tabs. I did a
    > quick test and made the text in a tab to link to another
    page, but it didn't do
    > anything (though the "content" section links of other
    tabs worked fine). Should
    > I simply delete this part: <div
    class="CollapsiblePanelContent"></div> ?
    >
    > Here's an example of the web page, though it is still
    very much under
    > construction, and no links put in place yet in any of
    the "tab" sections of the
    > collapsible panels:
    http://www.freywine.com/NewSiteExamples/index4.html
    (I just
    > want you to see how I'm using the collapsible panels,
    and how the "Home" and
    > "Order Here," for example, will have no text in their
    "content" sections of the
    > collapsible panels. Naturally, the parts with the
    downward pointing triangle
    > will have text with links in their "content" sections.)
    >
    > Basically, the question is: what's the best way to have
    the tab section be
    > just a link and the content section to not be there at
    all. I suppose I could
    > simply not use collapsible panel code, but then I would
    have to figure out how
    > to fit a non-collapsible panel div to fit right snug
    between all the
    > collapsible panels (I'm still very much a newbie with
    CSS).
    > Any simple way to deal with this?
    >
    > I've attached the complete collapsible panel code for
    the one which has the
    > tab text as a link and nothing in the content area.
    Thanks for the help!
    >
    > <div id="CollapsiblePanel2"
    class="CollapsiblePanel">
    > <div class="CollapsiblePanelTab"
    tabindex="0"><a
    > href="
    http://freywine.stores.yahoo.net/">Order
    Here</a></div>
    > <div class="CollapsiblePanelContent"></div>
    > </div>
    >

  • Simple X-fi Question, Please Help

    !Simple X-fi Question, Please HelpL I've been looking for an external sound card that is similar to the 2002 Creative Extigy and think I may found it in the Creative X-Fi. I have some questions about the X-fi though. Can the X-fi:
    1. Input sound from an optical port
    2. Output that sound to 5. surround- Front, surround, center/sub
    3. Is the X-Fi stand-alone, external, and powered by a USB or a wall outlet (you do not need a computer hooked up to it)
    Basically I want to connect a TosLink optical cable from my Xbox to the X-Fi. That will deli'ver the sound to the X-Fi. Then I want that sound to go to a 5. headset that is connected to the X-fi via 5. front, surround, and center/sub wires. The X-Fi has to be stand-alone and cannot be connected to a PC to do this.
    Thank you for your help.

    The connector must match, and the connector polarity (plus and minus voltage) must match.  Sorry, I don't know if the positive voltage goes on the inside of the connector or the outside.    Any wattage of 12 or more should be adequate.
    Message Edited by toomanydonuts on 01-10-2008 01:29 AM

  • Adding Date/Time Field + X Number of Days - Basic Calculation Question

    I am assuming this is a basic calculation question. New to Adobe LiveCycle Forms.
    I have a simple form containing a table. The table appears as such:
    Text
    Formatted as Date/Time Fields
    Header 3
    Monday
    user wil choose the beginning date (Date/Time) this is DateTimeField1
    Tuesday
    this should calculate DateTimeField1 + 1
    Wednesday
    this should calculate DateTimeField1 + 2
    Thursday
    this should calculate DateTimeField1 + 3
    Friday
    this should calculate DateTimeField1 + 4
    Saturday
    this should calculate DateTimeField1 + 5
    Sunday
    this should calculate DateTimeField1 + 6
    Calculations are performed after the date is chosen for Monday. My mind tells me the simple calculation of DateTimeField1 + 1 is not going to work (and in fact doesn't!) as it needs to change Monday to a number first. I saw on another thread the following:
    Num2Date(Date2Num(Date(DateTimeField1), "DD.MM.YYYY")+7, "DD.MM.YYYY")
    Thought this was going to get me close. No cigars though!
    Any quick help is greatly appreciated. And since I am new to this, details about what needs to be changed would be great too!
    Thanks

    Here an addition for you date field.
    This FormCalc script in the exit:Event will check it the selected date is on a monday.
    If not it will go the days back until the last monday.
    var Selection = Date2Num($.formattedValue, DateFmt(2))
    var WeekDay = Num2Date(Selection, "E")
    var NewDate
    if (WeekDay eq 1) then
              NewDate = Selection - 6
    elseif (WeekDay eq 3) then
              NewDate = Selection - 1
    elseif (WeekDay eq 4) then
              NewDate = Selection - 2
    elseif (WeekDay eq 5) then
              NewDate = Selection - 3
    elseif (WeekDay eq 6) then
              NewDate = Selection - 4
    elseif (WeekDay eq 7) then
              NewDate = Selection - 5
    else
              NewDate = Selection
    endif
    $ = Num2Date(NewDate, "EEE DD.MM.YYYY")
    Hope this helps, too.

  • Beginner XCode/Java Question - printf problem

    Hello,
    I have just started playing around with XCode and Java. I entered the statement:
    System.out.printf("%s\n%s\n", "Welcome to", "Java Programming!");
    into the default working java project (File -> New Project -> Java Tool) and Im getting the error "cannot find symbol" after I compiled it. I do not believe this is a syntax error since it was copied straight from a textbook. So, my questions are:
    1. What "symbol" is Xcode refering to?
    2. Does Xcode coem with the latest version of Java?
    3. How can I check the Java version?
    4. Is there a library that needs to be imported to get it working?
    Thanks in advance!

    Hi Arcus
    I think you might have to change some of the Xcode settings to force it to use Java 1.5. Try this:
    - From the menu, select: Project > Edit Active Target 'Your Program Name'
    - From the popup window, select Settings > Simple View > Java Compiler Settings.
    - Set Target VM Version and Source Version to 1.5
    - Dismiss the window by clicking on the red dot at the top left corner.
    Best wishes
    Bob

  • Sap basic java libs, JMON, JCO

    Hi,
    Iam applying patch 27 for the portal ep6 sp2. the current patch is ep6 sp2 patch3 with j2ee pl 19.
    Now first iam doing patch 4 for ep6 sp2 and then upgrading to patch 27.
    My question now is for upgrading to patch 4 what version of java libs, jmon and jco i should maintain and later for patch 27 what version of basic java lib, jmon and jco i should maintain.
    The patch4 document says to update basic javalibs, jmon and jco to the latest available one.
    The latest available patches are
    basic java lib - patch 18
    jmon - patch 19
    do anyone know how to do this. any documents are notes available ???
    Thanks for your help in advance
    regards
    Moses

    Hi Moses,
    here is what to you have to do:
    1. Patch the Software Delivery Manager (SDM) to the newest Patch Level (PL 14) - as described in SAP Note 532892
    2. Patch the J2EE Engine to the newest available patch (PL 30) - as described in SAP Note 738921
    3. Patch SAP Basic Java Libs 6.20 to Support Package 18 - as described in SAP Note 544979
    Make sure IRJ service is stopped as mentioned in the thread Basic Java Libs 16
    4. Patch JMON to Patch Level 19. Installation (path were to copy the files) is described in SAP Note 657143. Unfortunately this note is not released. If you don't have a user to see the note, here is in short what you have to do:
    - unzip the archive: "sapcar -xfv JMON_19*.SAR"
    - copy file jmonapi.jar to the following directories:
         - ...j2ee_<Instance_Nr>adminlib
         - ...j2ee_<Instance_Nr>admin     ools
         - ...j2ee_<Instance_Nr>clusterdispatcheradditional-lib
         - ...j2ee_<Instance_Nr>clusterserveradditional-lib
         - ...j2ee_<Instance_Nr>clusterstateadditional-lib
         - ...j2ee_<Instance_Nr>clusterserverservicesfileworklibs
         - ...j2ee_<Instance_Nr>clusterserverstatefileworklibs
    - copy file jmon.dll and sapccmsr.exe to the directory:
         - ...j2ee_<Instance_Nr>os_libs
    5. If needed, patch SAP Java Connector to Service Release 2.0.10 - as described in SAP Note 682686 and the there mentioned installation guide.
    6. Now you can go on patching the Portal first to Patch 4 and than to Patch 27 as described in the installation guides.
    Hope this helps,
    Robert
    PS: Please consider rewarding points to people like Dominik (and me) , who are spending a lot of their time to give helpful replies like in this thread: cross domain SSO-EP6

  • A few basic string Questions

    I would like to know how to make a string with the same characters as another string. Also, how can I set an int with the same value as there are characters in a string. It would really help if you gave me an example, because I am new to java and pretty much lost.

    That page has alot of information, but I really don't
    know how to use any of it. It would be really helpful
    is some one gave me an example. I see something like
    "int length ( )", but I don't know how to use it.You don't know how to call a method? Then you need to start from the very beginning:
    Sun's basic Java tutorial
    Sun's New To Java Center. Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    http://javaalmanac.com. A couple dozen code examples that supplement The Java Developers Almanac.
    jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    Bruce Eckel's Thinking in Java (Available online.)
    Joshua Bloch's Effective Java
    Bert Bates and Kathy Sierra's Head First Java.
    James Gosling's The Java Programming Language. Gosling is
    the creator of Java. It doesn't get much more authoratative than this.
    Here's a freebie though:String str = ...;
    int len = str.length();

  • Basic iPhoto questions:

    I have some Basic iPhoto questions before I start using the program:
    - does iPhoto apply any compression or change images in any way when they
    are imported?
    - after images are imported, can the original source folder of images be deleted off of the mac?
    - can Quicktime files exported from iPhoto be viewed on a Windows computer?
    - can iPhoto handle large resolution images that might be as large as 8-15mb each? does it display them quick? are there any known file size issues?
    Thanks!!!!

    kat.
    Is there a way to use iPhoto on a network so other users can read and possibly write to an iPhoto library on a networked mac?
    iPhoto is a consumer level photo organiser, not a server. It's possible to share photos but libraries are very difficult and fraught with the danger of database corruption. Some have reported success.
    Is it possible to password protect or secure certain images in the library so they can not be seen by anyone?
    No. The best I can suggest there is to create a second library and store it in a secure area like a protected dmg. But remember, you can only have one library open at a time.
    After photos are deleted from iPhoto, are there any remaining traces or cached files anywhere other than the trash
    If you delete photos from iPhoto and empty the iPhoto trash then the pics are removed from the Finder as well. They remain as findable as any other deleted file from that point, which is, very, if the searcher in knowledgeable.
    Regards
    TD

  • Object class deployment - Basic form question

    OK, I subclass calendar object from Oracle provided standard
    object class. What do I need to deploy to use this form now
    apart from calendar.pll and my fmx. What about the object class
    from which I sub-class. Do I need to compile and deploy that
    also? How will form resolve this on run time the parent object
    class as I really did not copy, just sub class and we do not
    deploy original class? Basic form question. Thanks.

    You can set the "help" property on the field (which gives you the little "information" icon link beside the field).
    You could also try adding another field of another class above or below:
    <Display class='InlineAlert'/>
    <Display class='ErrorMessage'/>
    <Display class='HtmlPage'/>
    ..etc
    -Rob

  • Basic java comparision

    Hi..
    I have a basic JAVA problem..can anyone help on this.
    I have a constant declared in a EMPConstanta.java
    public static String HISTORICAL = "historical";
    In another java class..i need to compare 2 strings..
    String statusType = req.getParameter("historical"); //this vale comes from JSP hidden parameter and the value of statusType is historical
    Now I want to compare with constant vale.. and I am doing like this..
    if(statusType.equals( ASMConstants.HISTORICAL)){
    statusType = ASMConstants.CURRENT;
    Problem is both the values are historical�but it is not entering to if condition..any suggestions

    http://forum.java.sun.com/thread.jspa?threadID=5203921&tstart=0
    avoid multi post

  • How do i get a plain and simple basic bank reconciliation form?

    how do i get a plain and simple basic bank reconciliation form?

    If you have a system with Microsoft Office Document Imaging loaded, you can Print the PDF to this application. Then once the document opens, Print it to Adobe PDF. This will avoid the distilling errors.
    It is part of Office XP, 2003 & 2007 I believe.
    Otherwise you may be left with Print & Scan.
    Good Luck
    Mark

  • Berkeley DB master-slave replication basic java code example

    Hi,
    I am new user of berkeley db and I have limited knowledge of Java programming. Can someone help me with basic Java example code of how to do master-slave replication without elections.
    Thanx,
    Jani

    Hello,
    Please clarify a few points about your program:
    1. What platform and Berkeley DB version are you using?
    2. Are you planning on using the replication framework
    or base replication API for your application?
    3. When you say you want replication without elections,
    what exactly does that mean. For example, if you are using
    the replication framework elections are held transparently
    without any input from your application's code. In this case,
    DB will determine which environment is the master and which
    are replicas. Is that what you are thinking about or
    something else?
    Thanks,
    Sandra

Maybe you are looking for