Results 1 to 7 of 7
Thread: void type not allowed
- 12-15-2010, 09:25 PM #1
Member
- Join Date
- Dec 2010
- Posts
- 8
- Rep Power
- 0
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++;
}
}
- 12-15-2010, 09:44 PM #2
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 787
- Rep Power
- 11
no return value = the method print cant print anything :)
what output did you expect?Last edited by eRaaaa; 12-16-2010 at 04:54 PM.
- 12-16-2010, 09:55 AM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 26
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?
- 12-17-2010, 07:24 PM #4
Member
- Join Date
- Dec 2010
- Posts
- 8
- Rep Power
- 0
ok thank you
=)
done
-
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.
- 05-05-2011, 03:43 PM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 26
Spam reported.
- 05-05-2011, 06:26 PM #7
Member
- Join Date
- Dec 2010
- Posts
- 8
- Rep Power
- 0
Similar Threads
-
What is the difference between Public Static Void and Public Void?
By whateverme in forum New To JavaReplies: 1Last Post: 12-04-2010, 06:41 PM -
'void' type not allowed here
By Torgero in forum New To JavaReplies: 15Last Post: 10-05-2008, 12:08 AM -
The different of static void,protected,and void in methods?
By Winarto in forum New To JavaReplies: 5Last Post: 01-25-2008, 12:53 AM -
is void a type?
By mary in forum New To JavaReplies: 3Last Post: 08-01-2007, 09:12 PM
Bookmarks