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.

Similar Messages

  • 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

  • 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

  • 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

  • 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

  • Making some basic Java games

    Can anyone help on how to make some basic java games for my website if you could that would be helpful
    thanks,
    Louie

    Well, first of all you program the Framework, add Graphics / sounds / Data , then you put it in your HP - There you are!

  • Knight tour programming with only basic java

    i had this assignment from school which ask us to create a program to calculate how many posssibilities to complete knight's tour from a position using basic java and not using applet. So far i can only create an incomplete program which can only go a speccific way and is also incomplete. i am trying to understand the jaava applet type of knight tour program but got too confused as i have just started learning this. Please help me with this.
    here's my code:
    public class uk16638_a3{
         public static void main(String[] args){
         int horizontal[] = {2,1,-1,-2,-2,-1,1,2};
         int vertical[] = {-1,-2,-2,-1,1,2,2,1};
         int chessBoard[][]=new int[8][8];
         int move, currentRow = 0, currentCol= 0, move_count = 0, new_vert, new_horz;
    for(int i=0; i<8; i++)
         for(int j =0; j<8; j++)
              chessBoard[i][j] = 0;
    chessBoard[0][0] = 1;
    do{
    for(move=0;move<8;move++){
    new_vert = currentRow + vertical[move];
    new_horz = currentCol + horizontal[move];
    if ( (new_vert>=0) && (new_vert < 8) )
    if( (new_horz>=0) && (new_horz < 8) )
    if( chessBoard[new_horz][new_vert]==0 ) {
    chessBoard[new_horz][new_vert] = 1;
    move_count++;
    currentRow = new_vert;
    currentCol = new_horz;
    }}}while(move<8);}}

    Sorry with the inconvenience cause i am new with this forum so i am causing many problems to all of you. here's the full code i put but i would really like to ask someone to teach me on creating a backtrack and let the knight moves following a different sequence from the one i already set.
    public class uk16638_a3{
    public static void main(String[] args){
    //the movements of a knight horizontally and vertically
    int horizontal[] = {2,1,-1,-2,-2,-1,1,2};
    int vertical[] = {-1,-2,-2,-1,1,2,2,1};
    int chessBoard[][]=new int[8][8];
    int move, currentRow = 0, currentCol= 0, move_count = 0, new_vert, new_horz;
    //setting all elements in the array to 0
    for(int i=0; i<8; i++)
    for(int j =0; j<8; j++)
    chessBoard[i][j] = 0;
    //the knight starts here
    chessBoard[0][0] = 1;
    //using do while loop, i try to move the knight following the sequence i had already set in the array above. But because its moving at the same direction all the time, it gets stuck.
    do{
    for(move=0;move<8;move++){
    //setting the new coordinates for it to move to
    new_vert = currentRow + vertical[move];
    new_horz = currentCol + horizontal[move];
    if ( (new_vert>=0) && (new_vert < 8) )
    if( (new_horz>=0) && (new_horz < 8) )
    //new position check if its already occupied or not, if occupied it will move on to the next part of the move sequence i set
    if( chessBoard[new_horz][new_vert]==0 ) {
    chessBoard[new_horz][new_vert] = 1;
    move_count++;
    //current coordinate of the new knight position
    currentRow = new_vert;
    currentCol = new_horz;
    }}}while(move<8);}}
    Edited by: Mikki88 on Mar 2, 2009 1:53 AM

  • Java Question... please help

    I am running  Snow Leopard  (mac os x version 10.6.8)
    For the past couple of years I've played gin in yahoo games.  
    Yesterday when I entered the gin lobby ...the font was so tiny
    I wasn't able to read it.   I checked Java on my computer and
    it is enabled, however I just realized when I go into the gin
    lobby... there is no java icon on the dock.   Since the font size
    is fine in all other applications, I am presuming this is a Java
    issue.  
    Help if you are able.. please and thanks

    Huh? Is this a Java question? Where's the Java? I just see a little JavaScript. Do you know how to use servlets and JSPs?
    Jesper

  • What kind of Java questions can I ask?

    Here's a change:
    I want to interview some good java people. I have lots of Java questions in mind which I could ask them, however fellow JavaGuru's
    I would like some potential questions from you which I could ask someone who claims he/she is a good java programmer??
    I am asking because I want to be as fair as possible to the applicant and not ask them questions which I think are tough etc...

    Touchy subject.
    The language is not as important, as understanding programming concepts.
    So fine, when the programmer's horizont involves some abstraction levels.
    If a programmer can write an UML class diagram for a linked list.
    If a programmer knows a design pattern Singleton.
    If a programmer can write his/her own single linked list class with sorted insertion.
    Language concepts:
    - Why:
    import java.util.*;
    Map map = new HashMap();
    - Answer:
    Hiding the choice of implementation (HashMap) by using the more general
    interface Map.
    Don't expect much on an interview though. The situation might not be
    adequate to distinghuish between the good and the bad apples.
    Talking code is a good starting point, code of your making unfortunately.
    A good programmer will hesitate to show really useful code.
    A bad programmer might have stolen his/her code.
    The problem you might have, that you are in search of an expert, not
    having the expertise in-house. In that case you might get a better
    picture, talking about which IDE would be opportune, whether he/she
    has experience with the source version system CVS, what would his/her
    ideas be about coming projects.
    That would establish a common line of communication.

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

Maybe you are looking for

  • Want to make fiscal quarters from fiscal periods in Info design tools

    Dear Gurus: I have new reporting requirement for fiscal quarters, currently I have fiscal periods and fiscal years in my business layers. I have two questions from you guys. 1) Which is the better way to achieve this. Should I try to make it in IDT o

  • Activity Confirmation

    Hello all, Scenario is- A FERT material assigned in the project which creates WBS reservation. FG is produced by production order and then delivered from Project stock. Before delivery of the FERT, I want to check the activity confirmation to which F

  • Can I initate the camera to take a picture from inside photoshop?

    I used to work with a photographer that had their DSLR connected to their computer and what I thought was Photoshop open (it was awhile ago so I can't for sure remember) and then from in Photoshop he could click a button for the camera to take a pict

  • How do I print more copies, in black and white, or on specialized media?

    The Universal Crossword Print Widget has been discontinued, and there will be no new content. However, you can still receive the Universal Crossword printable by subscribing on your HP web-enabled printer's front panel, or by visiting HPConnected.com

  • 'twitter' in film on television monitor

    Dear All, I'm getting close to completing a film made with stills and voice-over. The stills are black-and-white 35mm images, imported into FCE 2 as TIFFs. I exported to QuickTime as DV-PAL and burnt a disc using iDVD. When I showed the film on my do