Thread: Help Urgent!!Writing it prac grade 11 tomorrow and need help! SQL and Java

  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    5

    Exclamation Help Urgent!!Writing it prac grade 11 tomorrow and need help! SQL and Java

    hey peeps, i have a really big probelemo...i'm in grade 11 and writing i.t p1 prac on monday and still dunno how to call a method from another to a class.....im trying to create a simple program........
    Code:
     
    public class Display
     {
      void display(String heading)
       {
    	 System.out.println("My name is bob.");
       }
     }
    then call it from this class
    Code:
     
    public class CallDisplay
     {
      public static void main(String[]args)
       {
    	 Display print = new Display();
    	 print.display();
    	 System.out.print(print);
    	}
     }

    And i need to know how to use simple sql statements in java....(for example if i were connecting a database from Access into JGrasp.....eg. getNames();

    Also i need a few tips on string handling, like how to split or delete strings/characters....

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    This has nothing to do with C++ - moved to Tech.

    vipur - you could always try posting on a Java board...

  3. #3
    Registered User
    Join Date
    Nov 2009
    Posts
    5
    oki sorry i will, lol someone in thec programmin forum told me to post here...........shot anyway

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    This has nothing to do with SQL, but whatever.

    In your case the code isn't working because you declared display() to take a string as an argument and yet you aren't passing that argument when calling the method.

    Code:
    Display print = new Display();
    print.display("some string");
    System.out.print(print);
    There may be other problems with your code, but I can't help. I don't know Java.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #5
    chococoder
    Join Date
    Nov 2004
    Posts
    515
    If it were really urgent I'd help, but stating that something is urgent when it isn't?

    Anyway, if OP were to go through the Java tutorial on Sun's website (and maybe even pay attention in class...) he'd readily find all the information he needs.

    What Mano says is true. Of course the code as corrected likely won't print what OP intents it to, but at least it should compile.

Popular pages Recent additions subscribe to a feed