Alain Boucher

Ranch Hand
+ Follow
since Feb 25, 2003
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 Alain Boucher

Sure... your applet can access your servlet, the your servlet send the drawing over http. In your applet, you get the response, read the data byte by byte in a array[] then you do what ever you want with it. What you describe is the normal way to do that:

http://mindy.cs.bham.ac.uk/AppletServletExample/
18 years ago
Tell your customer that you will take a look at the problem monday morning.

You are on Holiday...
19 years ago
Hello... good question here.

Don't look for a java solution... it's a Compiler issue. The Compiler look if the exception is the class java.lang.Exception... create yourself a java.lang package, create a Exception Class that extends Throwable, like the original, then use this Exception... it will work...
19 years ago
Both are zipped files

jar = normal class/java file OR EJB Files

war = Web Application archive (Class, jsp, images etc...)
19 years ago
Try This:

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;

import javax.swing.*;

public class Read extends JFrame{

public static void main (String [] args) {
try{
System.out.println("Begin");
File myFile = new File ("c:\\doc2.txt");
FileReader fr = new FileReader (myFile);
BufferedReader r = new BufferedReader(fr);

String line = r.readLine();

JOptionPane op = new JOptionPane(line);

Read inst = new Read();

inst.setSize(400,400);
inst.getContentPane().add(op);
inst.pack();
inst.setVisible(true);
}catch (Throwable e){
System.out.println("ERROR: " + e.getMessage());
}
}
}
19 years ago
One possible solution:

String t = "123456";

for (int curs=t.length()-1;curs>=0;curs--){
int g = new Integer((""+t.charAt(curs))).intValue();

System.out.println(g + "");
}
19 years ago
Well... the main goal of a finally statement is that we are almost sure that it will be execute if exceptions are throw. If you don't want it to be executed just don't put a finally statement... or use a boolean in your finally

boolean doFinally = true;

try{

}catch (Throwable e){
doFinnaly = false;
}finally{
if (doFinally){
//Statement
}
}


But this is stupid code...
19 years ago
Question 1:

How can you get a instance of a private class if their is no public constructor.

public class1{
private class2{
private class2(){}
}

public static void main(String args){
//How can I create a class2 here... the private constructor can only be instanciate inside the class2 method
}
}


Question 2:
super() call parent constructor
this() call default constructor of the current class
19 years ago
Hashmap.class:

public class HashMap extends AbstractMap implements Map, Cloneable,
java.io.Serializable {
/**
* The hash table data.
*/
private transient Entry table[];

etc...

Entry is private... you cannot use Hashmap.Entry because you are not in a method in the Hashmap class, this field is private to that class

The Entry class is a Inner class of HashMap, so it is for internal use only (because of private)

Only use public method to get your data
19 years ago
1 .public class TestObject{
2 .
3 .int integerNumber;
4 .String sentense;
5 .
6 .public void myfunction(){
7 . String string1;
8 .
9 . string1 = "toto";
10. }
11.}

When you declare a object
TestObject obj1; //This is declaration

obj1 = new testObject(); //Instanciation

When the Object is created, the value of integerNumber (line 3) and sentense (line 4) are set to 0 and null

In the function at line 6 the declaration of object string1 is ok, but it's not null... because in a method object aer not automaticly instantiate... so you have to initialize it (line 9) to use it.
19 years ago
Wow... you must be working for a huge stupid company my friend... if they pay you to debate on those thing... If I was the manager at your place, I would tell you to use Java Standard... You try to use java, so why you don't follow the java standards...
19 years ago
You need to override the equals method in your Product class:

public boolean equals(Object e){
if (e instanceod Product){
//code to check it's equals
return true;
}

return false;
}

It's working with String object because the equals method is override with that class. Because you did not override the equals method it use the Object equals that simply look if the reference id is the same.

Easy one
19 years ago
Suppose you have a object of type "MyObject" that have a method call callMeOstie() that take no parameter... you can call it like this:

MyObject obj1 = new MyObject();

MyObject.class.getClass().getDeclaredMethod("callMeOstie",null).invoke(obj1,null)

It's that easy...
19 years ago