Vidya Venkatesh

Greenhorn
+ Follow
since Mar 06, 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 Vidya Venkatesh

hi, when I compile this program, compiler complains that the reference to the variable value is ambiguous. Here I2 extends I1, then why doesn't its version of value hide that of I1 ?
Thanks
Vidya
class Test implements I1, I2
{
public void f() { System.out.println(value); }
public static void main(String[] args)
{
Test t = new Test();
t.f();
}
}
interface I1
{
int value = 1;
void f();
}
interface I2 extends I1
{
int value = 2;
void f();
}
hi thanx for the reply. I still have a doubt, instance variables are also initialized to their default values before the constructor is called, right ? Then how can you reinitialize a final instance variable in the constructor ?
Thank You
Vidya
hi, the below program does not compile giving the error that you cannot assign a value to a final variable. However if I remove the static keyword, it compiles fine. What is the difference in both cases ?
Thanks
Vidya
public class Test
{
static final boolean bool;

public Test()
{
bool=true;
}

}
hi I have a very fundamental question. The float datatype is of 32 bits and long is of 64 bits. Then why doesn't this cause a compiler error ?
long a = 1;
float c=a;
Thanks a lot
Vidya
hi friends, in this program given below , the print() method is inherited by the subclass. Then why does it print the value of variable s of the class Base ?
Thanx a lot
Vidya
class Base{
String s = "Base";
void print(){
System.out.println(s);
}
}
class Derived extends Base{
String s = "Derived";
}
public class Test {
public static void main(String[] args){
Derived b = new Derived();
b.print();
System.out.println(b.s);
}
}
[ April 29, 2003: Message edited by: Vidya Venkatesh ]
hi
I have images stored in a zip file on the server. I tried reading them using ZipInputStream, but the images are not retrieved properly when there is a client side proxy server. Otherwise it works fine. Is there any way to get over this ? Can the same be achieved in any way other than using ZipInputStream ?
Thanks
Vidya
21 years ago
hi
Thanks for the reply. But if it was a problem with the proxy, then the Image object would also have been null, right ? Here the Image object is created properly, but the ImageIcon is null. Why would the ImageIcon object be null inspite of creating it by saying ImageIcon icon=new ImageIcon(image);
// where image is a Image object
Thank You
Vidya
21 years ago
hi I'm facing a problem with ImageIcon. In my applet, I'm trying to read images from a zip file on the server. The image objects are read and created correctly, but the ImageIcon objects which I make from the Image objects are null. The interesting part is that this is happening only when I run the applet from my office computer. When I run it from home, the ImageIcon objects are not null and displayed correctly. The code is shown below. Please advise.
Thank you
Vidya
public static Hashtable getImageTableFromZip(String zipFileName)
{
Hashtable imageTable=new Hashtable();
ZipInputStream zipIn;
try
{
String zipFilePath=Environment.getInstance().getImageZipUrl ();
URL url = new URL(zipFilePath+zipFileName);
InputStream in = url.openConnection().getInputStream();
BufferedInputStream bufIn = new BufferedInputStream(in);
zipIn = new ZipInputStream(bufIn);
ZipEntry zipEntry;
while((zipEntry = zipIn.getNextEntry()) != null)
{
Image image=extractImageFromZip(zipIn);
ImageIcon imageIcon=new ImageIcon(image);
System.out.println ("image is "+image +" imageicon made from image is "+imageIcon);
imageTable.put(zipEntry.getName(),imageIcon);
}

}catch(Exception e){e.printStackTrace(); }
return imageTable;
}
21 years ago
Thanks so much. Now it is clear to me
Vidya
hello friends
In this program I'm not able to bring the thread t1 out of the waiting state. Isn't notifyAll() supposed to wake up all waiting threads. Am I doing anything wrong ?
class TestThread extends Thread {
public void startMe()
{
synchronized(this)
{

notifyAll();
System.out.println("Not");
}
}
public void run() {
try
{
synchronized(this)
{
wait();
System.out.println("Notified");
}
}
catch(InterruptedException e)
{}
}
public static void main(String[] args) {
TestThread t1 = new TestThread();
t1.start();
t1.startMe();
}
}
Thanks
Vidya
[ April 23, 2003: Message edited by: Vidya Venkatesh ]
hi when I try to compile this piece of code it gives me the error "InterruptedException is never thrown in this block".
try
{
// code which does not throw Exception
}
catch(InterruptedException e)
{}
But if I change InterruptedException to Exception here, then it compiles. Why is this happening ?
It should have given an error "Exception is never thrown in this block". Please advise,
thanx
Vidya
hi I have some doubts in Collections.
Are there any collections which do not allow null values ?
Can objects of any class be used as the key of a HashMap ?