User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 401,534 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,385 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 1235 | Replies: 1
Reply
Join Date: Sep 2004
Posts: 24
Reputation: PeterX is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
PeterX PeterX is offline Offline
Newbie Poster

Solution java question

  #1  
Sep 29th, 2004
Hi!
1-My metod has 4 int parameter, and return true if least one of those parameter
can be dividable with 5. otherwise return false.
2- if least two or three of those parameter can be dividable with 5.

class Test{
public static void main(String[]args){
NumberTest myNbr=new NumberTest();
int result=myNbr.getMinNbr(3,1,9,6);
System.out.println(result);
}}

class NumberTest{

int divid=0;
public int getMinNbr(int nbr1,int nbr2, int nbr3, int nbr4){

if(nbr1%5==0)
delbart=nbr1;

else if(nbr2%5==0)
divid=nbr2;

else if(nbr3%5==0)
divid=nbr3;

else if(nbr4%5==0)
divid=nb;
return divid;
}}
My question:1: How I can return true or flase
2: How the program puts out two or more digit
if these are true.

3.if all oh them have the same value.

thanks
Peter
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2004
Location: Pakistan
Posts: 1,673
Reputation: nanosani is an unknown quantity at this point 
Rep Power: 8
Solved Threads: 50
Colleague
nanosani's Avatar
nanosani nanosani is offline Offline
Unauthenticated Liar

Re: java question

  #2  
Sep 29th, 2004
you could use : public boolean function(int param1, int param2...){}

boolean is used to return true or false .....

and you can use if statements ... for your last two questions.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Java Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 3:13 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC