ASHISH KUMAR

Greenhorn
+ Follow
since Feb 15, 2001
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 ASHISH KUMAR

hi Shabbir,
problem with your code is that u r trying to access instance variable a in main without a object of class d.
your main should be like this==>
public static void main(String args[]) {
d f = new d();
f.increase(f.a);
System.out.println(f.a[2]);
}
I hope this helps you.
ashish
Hi Ideal,
No false, true & null are not java keywords , rather they are reserved literals.
bye
Ashish
Hi Nitin,
there is no way u can predict which thread comes out waiting state first and goes into ready state.
if u 've called notifyAll() all the 3 threads will go to ready
state.
I hope this helps u.
bye
ashish
Hi Noel,
I think u 've misquoted your question, coz what i see in your code is nothing is tricky and class in t2 is not getting envolved in any way.
Only thing I see tricky in this case is that all of three classes are declared in a single file, since all three classes are declared public, and a file can't can 've more than 1 public class or interface.
if that's not the case than it should print==>
2
2
'coz u r creating object of t1 in the main of t.
as there is no constructor in t1 , i is getting intialized to 2.
so call to tins.i prints 2
and call to tins.amethod prints 2.
I hope this helps u.
bye
ashish
Hi Nitin,
First of all your question is not clear enough for me.
1.wait() method is used to make a thread currently executing a synchronized code go into waiting state.
2.synchronized keyword is used to make a method or block synchronized.
3.setPriority method is used to set the priorty of a thread, and that has to be done before calling start() method of that thread
other wise setPriorty() method has no effect. setPriorty method takes a value between 1 and 10.
4.sleep() method makes the thread executing the code go into waiting state for minimum time given as argument to the sleep() method.
So i presume B and D are answers u r looking for.
I hope this helps you.
regards
ashish
Hi Kedar,
According to me implicit casting of char to short is not allowed.
The graph of implicit casting is like this
byte-->short-->int-->long-->float-->double
char-->int-->long-->float-->double
There is no implicit casting between char to short or vice versa.
And u even can't cast a byte to char implicitly, even thow byte is 8 bits and char is 16 bits.
I hope this helps
Ashish
Hi everybody,
can somebody help me.
I'va a problem regarding accessing my local machine's hardisk through Sockets.What should be the URL,Port & protocol.
Should the port be unique to a machine or any Port should work.
I've tried
InetAddress inet = new InetAddress ("file:///c:"+File.seprator+"FILENAME");
It is not working. Iam checking for working of Sockets & URLs
using my hard disk and not the web.
Anybody having a solution or suggestion please help me.
thanks
Hi Cherry,
u can only intialize final variable while u r declaring
it or in the constructor of the class.
I hope this'll help u out of your problem
Ashish
Hi Vegad,
3 is invalid because, u r trying to cast a long array into
int array. Arrays of primitive type can't be casted into
other types.
4 is valid because u r declaring an array of 4 rows. and
each row can have same no. of columns or variable columns
later.
here is an exam. for ques. 4==>
int [][]x = new int[4][];
for(int i=0; i<x.length; i++)>
{
x[i] = new int[i+1];
}
now x[0] has 1 elament
x[1] has 2 element
x[2] has 3 elament
x[3] has 4 element
I hope this will help u.
Ashish
Hi,
static variable of System class is PrintStream object.
Ashish
23 years ago
HI ZHOU & SIVALINGAM,
ANSWERS FOR ZHOU'S QUESTIONS ARE
1. D
2. C
3. B
D. BE