Results 1 to 1 of 1
- 03-07-2010, 09:25 PM #1
Member
- Join Date
- Mar 2010
- Posts
- 1
- Rep Power
- 0
Hello I am new to java and little help
Hello to all,
The point is that im doing now my coursework but I need to submit it in 2 hours and i still can't aswer these questions can u pls help as soon as possible i will be very thankful. In questions '????' means that i should replace it with answer
Question 1:
Provide code to replace ??? below that uses a conditional operator to give i the value of the maximum of two int variables x and y.
int i = ???;
Question 2:
Suppose my root directory C:\ contains a Java file Bob.java and a directory javaclasses containing library classes. If my command prompt is in the directory C:\, what should replace ??? in the command javac -classpath .;??? Bob.java so that the compilation will be successful?
Question 3 :
The partial answer below to question 24 will consider all possible divisors in determining if a number is not prime. Provide a for loop (i.e. a complete replacement for the 1st line below) that only checks for divisors that are less than or equal to the square root of n.
for (int i = 2; i < n; ++i)
{
if (n % i == 0) {
return false;
}
}


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks