Results 1 to 7 of 7
  1. #1
    jockhip12 is offline Member
    Join Date
    Dec 2010
    Posts
    8
    Rep Power
    0

    Default void type not allowed

    void type not allowed here
    System.out.println(sh.achat_Produit("xxx",120,10);
    __________________________________________________ ______________
    package shopping.client;


    import javax.naming.InitialContext;
    import shopping.bean.ShopRemote;

    public class Client
    {
    public static void main(String[] args) throws Exception
    {
    InitialContext ctx = new InitialContext();
    ShopRemote sh = (ShopRemote)ctx.lookup("ShopBean/remote");
    }
    }

    __________________________________________________ ______________
    import javax.ejb.Stateful;
    import javax.ejb.Remote;



    @Stateful
    public void achat_Produit(String produit, double prix, int qte)
    {
    for (int nbp=0;nbp<tabProduit.length;i++)
    {
    tabProduit[nbp]=produit;
    tabPrix[nbp]=prix;
    tabQte[nbp]=qte;
    nbp++;
    }
    }

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    5

    Default

    no return value = the method print cant print anything :)
    what output did you expect?
    Last edited by eRaaaa; 12-16-2010 at 03:54 PM.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,742
    Rep Power
    19

    Default

    println() expects an object (or something anyway).
    achat_Produit() has no return value, so cannot be returning an object.

    That's your problem.

    As eRaaaa asks, what is it you're trying to achieve?

  4. #4
    jockhip12 is offline Member
    Join Date
    Dec 2010
    Posts
    8
    Rep Power
    0

    Default

    ok thank you
    =)
    done

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    If your question has been answered, please click on Thread Tools above and mark this question solved. Thank you.

    Also, this is hardly an advanced Java question and so I'm moving this to the New to Java section.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,742
    Rep Power
    19

    Default

    Spam reported.

  7. #7
    jockhip12 is offline Member
    Join Date
    Dec 2010
    Posts
    8
    Rep Power
    0

Similar Threads

  1. Replies: 1
    Last Post: 12-04-2010, 05:41 PM
  2. 'void' type not allowed here
    By Torgero in forum New To Java
    Replies: 15
    Last Post: 10-04-2008, 11:08 PM
  3. Replies: 5
    Last Post: 01-24-2008, 11:53 PM
  4. is void a type?
    By mary in forum New To Java
    Replies: 3
    Last Post: 08-01-2007, 08:12 PM

Posting Permissions

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