Results 1 to 2 of 2
  1. #1
    coco is offline Member
    Join Date
    Jul 2007
    Posts
    39
    Rep Power
    0

    Default Help with parameters values in java

    Hi, Some time ago I read about default parameter values, like
    Java Code:
    public blah(int a=0, int b=2) { ... }
    or at least I thought I did, cause it wont work when I try it out.
    Ive searched Google, but cant find anything.
    Am I doing it wrong, or is this not supported in java?
    Thanks.

  2. #2
    brianhks is offline Senior Member
    Join Date
    Jul 2007
    Posts
    135
    Rep Power
    0

    Default

    That is a really cool C++ thing and not part of Java. Sorry.

    You do that in Java with
    Java Code:
    public blah(int a) 
    {
    bla(a, 2);
    }
    
    public blah(int a, int b)
    ...
    Same effect, just not as cute.

Similar Threads

  1. Replies: 4
    Last Post: 04-15-2008, 01:04 PM
  2. Netware: JAVA.NLM Version 1.31h Parameters
    By Larry Mateo in forum New To Java
    Replies: 0
    Last Post: 03-20-2008, 11:34 PM
  3. Hiding parameters from URL
    By Saurabh321 in forum New To Java
    Replies: 0
    Last Post: 02-05-2008, 12:43 PM
  4. alphabetizing parameters
    By jjsaw5 in forum New To Java
    Replies: 2
    Last Post: 08-15-2007, 05:43 PM
  5. get parameters in jsp
    By cecily in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 08-05-2007, 04:29 AM

Posting Permissions

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