SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Java?

  1. #1
    Non-Member
    Join Date
    Mar 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Java?

    What is an abstract method?

    Regards,
    Rajan.

    <snip />
    Last edited by guido2004; Mar 5, 2012 at 04:59. Reason: wait 90 days for a signature

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    I'm sorry, we don't deal with Java here, nor anywhere on this web site anymore.
    Correction:We do have a place here where Java questions can go, and that's in the General Web Development & Application Design Issues forum. I'll move this thread over there right now.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Wizard
    Join Date
    Dec 2003
    Location
    USA
    Posts
    2,582
    Mentioned
    29 Post(s)
    Tagged
    0 Thread(s)
    An abstract method is the same in Java, C++, etc.

    It's basically a method which someone has specified needs to be there, but they don't implement it themselves. You usually take the class that has the abstract method, extend it, then define your function.

    For example, let's say we have a class called Pet, and it has a method called Action. The Pet itself doesn't do anything with that action, so I'll mark it as abstract.
    Code:
    public abstract class Pet {
      abstract public void Action();
    }
    With an abstract method, I can't create an instance of Pet.

    However, now I want to define a Dog, using Pet.
    Code:
    public class Dog extends Pet {
      public void Action() {
        System.out.println("Bark");
      }
    }
    Now Dog has his own Action, and because there are no abstract methods, I can create a new Dog.

  4. #4
    Non-Member
    Join Date
    Nov 2010
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am new in Java and started my career in java. Facing problem for inserting ids of multiple categories. Help me out...

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,338
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by keyideas View Post
    Facing problem for inserting ids of multiple categories.
    one per row
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •