chin josei

Greenhorn
+ Follow
since Jun 22, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by chin josei

I have an html page with a button on it.
When the button is clicked an excel spread sheet is opened.
If this page is viewed as an html page everything works perfectly.
Now if this is put in a tomcat webserver(version 3.2) and tried to
access using http:\\localhost:8080\Mypage.html, on clicking the button
Iam getting an error message saying "Automation Server can't create object"
It looks like the permission needs to be set..So i changed the tomcat.policy file
adding something like this..
grant codeBase "file:$(tomcat.home)/webapps/ROOT"{
permission java.security.AllPermission;
}
I even modified the server.xml like this..
<Context path="/ROOT"
docBase="webapps/ROOT"
crossContext="false"
debug="0"
reloadable="true"
trusted="true">
</Context>
But still iam getting the same error...
Any ideas......
thanx
cj
22 years ago
Hi,
I have a certain problem with JTable.All the columns in the table are editable and I have created my own Model class by extending DefaultTableModel.I have implemented the various methods like getValueAt(),setValueAt(0 bla..bla..
Now my problem is the value I enter in column0 disappears when I move to next cell.But if I enter in any other cells it is working fine.
Any idea why this is behaving like this
cheers
chin
22 years ago
Hi,
Iam having a small problem with my RMI prgm.
I have a client and server both of which are Remote Objects i.e, both of them implements Remote Interface.Now when I run the application it works in one way say from Client to Server or from Server to Client.The other way it gives
Connection Exception ..Connection refused.......
If I do a lookup again it works perfectly..
Now what could be the problem?

thanks
josei
22 years ago
Hi,
Three strings are created i.e,
"Hello"
"Pal"
"HelloPal"
HTH
Hii..
U need to bind it to the JNDI tree.I have done it for Weblogic.
For Websphere also it might be similar
Herez what I have used.
Hashtable h1 = new Hashtable();
h1.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
h1.put(Context.PROVIDER_URL,"t3://localhost:7001");
Context jndictx = new InitialContext(h1);
jndictx.rebind("JNDI Name",this);
Hope this helps
chin
23 years ago
Hii..
Answer is 22..
y=x++ + ++x;
letz check this particular line where all the action is..!!!
1.initial value of x = 10
2.now for the first postfix increment operator(x++)
x++ uses the current value of x(which is 10)
3.x++ then adds 1 to x(now x = 11)
3.for the prefix increment operator(++x)
++x adds 1 to x(which is 11)and uses this new value
(x=12)
4.so the final value of expression
y = 10(from step2) + 12(from step4) = 22
Hope this helps
chin
Hii..
Iam not very sure..Correct me if iam wrong
In the case of (a) at compile time compiler checks
whether the expression for while(expression)is of
type boolean..hence it compiles properly..since the
resultant boolean value nothing is printed
In the case of (b) since at compile time itself
the while(expression) evaluvates to be false the
enclosing statement will never be executed,hence the
compiler cribs saying "Unreachable Statement"
Please correct me if Iam wrong
chin
Hii..
If a finally block is specified after the catch block,then
regardless of whether the catch block itself throws an
exception,finally block is executed.Hence whatever exception
that is thrown in catch block will be suppressed.
Just comment the finally block..
The program will throws ArithmeticException
Hope this helps
chin
thanx sandeep...
suppose if //1 is modified like this
System.out.println(tes1.toString());
the program won't throw any exception !!!
why does it throws NullPointerException when the toString()
method is called implicitly???
chin
Hi all..
This is from Sun Guoqiao's Mock Exam No. 1
The program throws a NullPointerException at //1
-------------------------------------------------------------
class Test001
{
int i;
public Test001(int i)
{
this.i = i;
}
public String toString()
{
if(i==0)
return null;
else
return ""+i;
}
public static void main(String[] args)
{
Test001 tes1 = new Test001(0);
Test001 tes2 = new Test001(2);
System.out.println(tes1); //1
System.out.println(tes2); //2
}
}
-------------------------------------------------------------
Could anyone please explain why?

thanx in advance
chin

U can put the properties file in classpath
and read using System.getProperty("java.class.path").
chin
23 years ago
Consider this piece of code
1 class Shapes
2 {
3 public void draw()
4 {
5 System.out.println("Shapes");
6 }
7 }
8
9 class Circle extends Shapes
10 {
11 public void draw()
12 {
13 System.out.println("Circle");
14 }
15 }
16
17 public class Main
18 {
19 public static void main(String args[])
20 {
21 Shapes sh = new Shapes();
22
23 Circle cir = new Circle();
24
25 Shapes sh1 = new Circle();
26
27 sh.draw(); // This will print shapes
28
29 cir.draw(); // This will print circle
30
31 sh1.draw(); // This will again print circle
32 }
33 }

1. At compile time compiler checks whether method is present
in the reference type.If not it gives a compile time error.
For example comment the draw() method in Shapes and try to compile
Compiler will crib saying -- can't resolve symbol draw() --

2. At runtime the exact object's method is executed(Not Always).
In the above case at line -21- reference 'sh' points to a Shapes object so ..draw()
method in Shapes class is executed.Similarly at line -23- circ points to a Circle
objet hence "Circle" will be printed.
Now take the third case...line -25-
Reference Type is of Shapes and it points to Circle object.Since there is a method
draw() defined in Shapes it will compile properly(Try commenting that compiler gives
a compile error).Now at run time the reference type will be pointing to Circle object
hence draw method of circle will be executed...
Try commenting the draw() method in Circle ...
draw() method of Shapes will be invoked...Here it executes the reference's(Shapes) method.
In this case eventhough the object is of type Circle , Shape's method is executed.
Hope this helps
chin
Hii..
JavaWebServer 2.0 uses older version of servlet.
Try using getValue() & setValue() instead of
getAttribute() & setAttribute().
Hope this helps
chin
23 years ago
Cameron,
In the program an_A is of reference type A.
At compile time compiler will look for methodTwo() in A..which infact is defined in b.Hence it gives a compile time error.
chin