haijun wang

Greenhorn
+ Follow
since Aug 18, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by haijun wang

How can I get the definition about this class from SUN JAVA library.
big thanks.
HAIJUN
23 years ago
Dear friends:
Anybody can tell me what is the algorithm of Java tokenizer class.about distinguishing the number or real string.
Haijun
23 years ago
Dear Mr. Bateman:
I have compiled and run your program. I did learn a lot from your program. Thank you very much. All of my questions have been cleared about this problem.
Haijun.
23 years ago
Dear Bateman:
Did you compile and run the program you posted here. I tried last night. It looks like there is small problems in it. It can not pass compilation.
Thank you again.
Haijun
23 years ago
Dear Shama:
Thank you for your help. One thing I am still comfucing is that when I input the expression, the input may be considered as string not integer. Last night, I was trying to make my program work. But I failed. Please give me some help to figure why my code can not be compiled.
Thank you.
HAIJUNpublic class Evaluator
{
public static void main(String [] args)
{
if (args.length == 0)
System.out.println("Missing Argument\n");
else
calculate(args[0], args[1], args[2]);
System.out.println("The answer is " + answers);
int calculate(int num1, String op, int num2)
{
int answers = 0;
if (op == "+")
{
answers = num1 + num2;
}
else if(op == "-")
{
answers = num1 - num2;
}
else if(op == "/")
{
if(num2 == 0)
{
display.setText("ERROR");
}
else
answers = num1 / num2;
}
else if(op == "*")
{
answers = num1 * num2;
}
return answers;
}//close calculate
}// close main
}// close class
23 years ago
Thank you for your help. I still have question about this problem. I think I need put space between the operand and operator. If I do'nt, the compiler will thought it a string. How can I get this function working without putting space there.
Thanks
Haijun
23 years ago
I have a question when I am trying to write a calculator rogram. I want to get input from command line, example 4+6 or 5*2. how can I read this input and make it call my method calculator(num1, "op", num2).
thank you
haijun
23 years ago
Hi my friends:
I am just a Java beginner, and have a question for you.
If I have a string, for example "12345", how can I change it to real integer without using wrapper class methods such as intValue() and parseInt(). Can I just use cast or something else.
Thank you in advance.
Haijun
23 years ago
Hi My friends:
I am trying to use JAVA file class to create a directory and file using following code in windows ME environment. The compile is ok, but it looks like both directory and file were not created. Could you please tell me the reason.
Thank you
Haijun
import java.io.*;
public class TryFile
{
public static void main (String [ ] args)
{
File myDir = new File ("D:/newFile/newFile/try");
System.out.println (myDir + (myDir.isDirectory()? " is" :" is not") + " a directory.");
File myFile = new File ("File.java");
System.out.println ( myFile + (myFile.exists() ? " does" : " does not" ) + "exist");
System.out.println ("you can" + (myFile.canRead() ? " " : " not ") + "read " + myFile);
System.out.println("you can" + (myFile.canWrite()? " ": " not ") + "write" + myFile );
return;
}
}
23 years ago
Dear Friends:
I have your help for read two text files into two different string arrays in order for me find the the words, which exist in one text file, also in other text file.
Haijun
23 years ago
Hi My friends:
I want to download the whole site to hard disk or zip drive. Anybody can teach me how to do that in order for me read offline.
Thank you
Haijun
Dear friends:
I am planning to learn JSP after finishing my SCJP certification. Anybody can give me suggestion how can I learn that? which books are best? and How can I practice.
Haijun
23 years ago
Thank you every one who gives me the detailed explanation for this basic questions.
Have a good day.
Thank you from deep heart.
Haijun
Hi My friends:
I have one question from Sreenivasa Kumar Majji's Sun Certified Java programer practice exam exam 1, still don't understand. Please give me a help. Thanks.
The question is:
1: public class Q8
2: {
3: int i = 20;
4: static
5: {
6: int i = 10;
7:
8: }
9: public static void main(String[] args)
10: {
11: Q8 a = new Q8();
12: System.out.println(a.i);
13: }
14: }
A) Compilation error, variable "i" declared twice.
B) Compilation error, static initializers for initialization purpose only.
C) Prints 10.
D) Prints 20.
the answer is D.
Another question is:
if a variable is defined and initialized in the class, and the same variable is defined and initialized in a method in the same class. What is the result if I print this variable in the local method or in the class scope?
Haijun
Hi Guys:
Right now I am using Jdeveloper to run my javacode. Unfortunately after compilation and run, I can not find the output. I checked the message view properties, showing the program output was checked.
I do not how to configure it to show my output.
Thank you
Haijun