Saif Ullah

Greenhorn
+ Follow
since Mar 21, 2002
Merit badge: grant badges
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Saif Ullah

I haven't run this example, but the loops sound to work like that. The loop with variable i, (outer loop) runs for three iterations as the first dimension of x array is 3, for each iteration, the inner loop iterates for 4, 2 and 5 times so total iterations are 11. I hope you can understand how inner loop is iterated for each individual size mentioned for 2nd dimension of x-array.
no import of java.io is needed,
saif ullah
Hi Shah
just change the second class that I have posted to Conditional.java, it was a mistake while posting that its name is posted as Conditional1.java.
Moreover, You are just printing the value, not assigning the double value to x, so there is no need for type compatibility, because implicit conversion will be applied.

system.out.println("value is" + ((x>4)?99.0:9));
it will work fine, with the code that I have posted previously

Saif ullah
Hi A.Shah
I have made this solution and its runs fine, due in both prosprectives, hard coding, and through command line parameters.
1. The java implicit conversion rules applies
here, as when there are two operands, one
double, then the other will automatically
converted to double.
2. There is no need to use if-else paradigm,
because conditional operators
automatically support simple if-else
paradigm.
here is hard code example
// comment any of the line 1, or 2, and check
// the result
public class Conditional {
public static void main(String[] args) {
int x = 3; // result will be 9.0 line1
int x = 6; // result will be 99.0 line2

System.out.println("value is " + ((x > 4) ? 99.9 : 9));
}
}

here is the command line example
run >> java Conditional 1
java conditional 2
java conditional 3
java conditional 4
will produce result 9.0
and java Conditional 5 or above will produce
result 99.0
class code
import java.io.*;
public class Conditional1 {
public static void main(String[] args) {

int x =Integer.parseInt(args[0]);
System.out.println("value is " + ((x > 4) ? 99.9 : 9));
}
}
Enjoy you work

Saif ullah
Congratulation!

Wish you good luck in future!
Saif Ullah
22 years ago
Thanks!
for the comments to improve the page, I have removed the flash animation, and looking forward to more guidance, because there is always
room for improvement.

Saif Ullah
22 years ago
Hi,
I have created notes on Servlets API 2.3, that is available at :::

http://www16.brinkster.com/saifpia/servlets/servlets.html
my home page is at
http://www16.brinkster.com/saifpia

thanks, and send comments to improve these notes
saif ullah
22 years ago
Lakhani!

If you are using Forms for the inputs, then there is no problem, you can use hidden fields, or url-rewritting if you like, there can be cookies available, or javax.servlet.HttpServletRequest interface's methods like setAttribute(), and getAttribute.
There are many other ways for setting and and retrieving attribute values.
I hope you can get the point, if you need more help write type of data you are retrieving.
A Java Student
Saif ullah
SCJP2
Quitters never win, Winners never Quit.
22 years ago
JSP
Hi Dongqing wu

Nice attempt, and good score, enjoy your success, and best wishes for the future.

Keep it up, cheer with friends

A Java Student
Saif Ullah
SCJP2
I think, Ilga preuss, also thinking according to the idea, I have presented, this will be more effective, and effecient, If you use, polymorphism the unknow objects will be known, at compile time, due to polymorphic behaviour, you will use an custom define interface, like GamePiece, then implement each new class with this interface, with names, like Knights, Queens, Rocks, thus you got the knowledge of unknown object at the casting time, it will help you,
If you still got problem try to write your program, so that I could get it, and try to understand what exactly you want to do.
Please don't be so persistent to Strings, try other behaviours (~_~)

A Java Student
Saif Ullah
SCJP2
22 years ago
I think, java's object oriented approach can server better than using String objects. Try to create simple classes for Knights, Queens, Rocks, then use them in the array, or you can also use utility Collection classes, for effecient search purposes, Thus it becomes easy to cast and recognize each gamepiece. I hope you got the point.
A Java Student
Saif Ullah
SCJP2
22 years ago
The answer should be F <BR>
because both array1 and array2 <BR>
are single dimentional arrays, so cast is ok<BR>
when we try to cast two dimentional arrays
<BR>to single dimentional arrays, like with
<BR> the choice B, and C, the compilation
<BR> error occured.

to verify, check javadoc utility<BR>
A Java Student
Saif Ullah
SCJP2
Shazam (~_~)

Uninstall the jdk1.4.0, then re-install the jdk1.4.0, this will solve your problem, because in this way jre 1.4.0 will be re-installed and your problem will be solved, JBuilder often cause this kind of problem.
Thanks, and please follow the naming policy of the forum
A Java Student
Saif Ullah
SCJP2
Quitters never win, Winners never Quit
yub huang (~_~)

Be happy and enjoy your success, and work hard in future for further studies, we all are with you here in the forum.
A java Student
Saif Ullah
SCJP2

Quitters never Win, Winners never Quit
22 years ago
Hi Sam and Simon!

I did not have idea about your book, because I am busy in reading Servlet Programming by Hunter & Crawford, Java Server Pages by Duane K. Fields, Kark A. Kolb. Inside Servlets, Java Server Professional Programming.
This is my first time, to participate in the this forum's give away,
By the way thanks for coming in the forum to explain the questions of my forum fellows, because I always wish this forum should be the best java forum in the world!

A Java Student
Saif Ullah
SCJP2
Quitters never Win, Winners never Quit.
22 years ago