kashif sohail

Greenhorn
+ Follow
since Dec 04, 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 kashif sohail

this is not the reply whic no of new ones like me expecting
anyway
thax
23 years ago
can body tell me what's wrong with this code and write method
thax
23 years ago
is there any body from pakistan specially from lahore or faisalabad is preparing for scjd if so why not join brains
kashif
well thanx but getInset was an example and thanx for link but what if i m looking for some other example and did not find any tutorial on that
do sun has some site to tell the exampled use of its api
kashif
tnax all but what about my second question
how to sync the method without usin sysncronized key word in mehtod definition (actulyy sync the some block of method)
2:
what if i wish to synchronize it like
synchronize(this){ //after line 1
but it gives me error
any help
actually my question is why 2nd thread did not runs (as it shows)
and would u plz explain the use of while
thanx
kashif
public class ethread extends Thread
{ int x;
int y;
public static void main(String []args)
{
ethread et=new ethread();
Thread a=new Thread(et);
Thread b=new Thread(et);
a.start();
b.start();
}
public void run (){
for (int i=0;i<10;i++)
{//line 1
x++;
y++;
System.out.println("x"+x+"y"+y+"CurrentThread"+getName());
}
}
}
the reuslt is like blew what i m not sure is where is the second thread
2:
what if i wish to synchronize it like
synchronize(this){ //after line 1
but it gives me error
any help

x1y1CurrentThreadThread-0
x2y2CurrentThreadThread-0
x3y3CurrentThreadThread-0
x4y4CurrentThreadThread-0
x5y5CurrentThreadThread-0
x6y6CurrentThreadThread-0
x7y7CurrentThreadThread-0
x8y8CurrentThreadThread-0
x9y9CurrentThreadThread-0
x10y10CurrentThreadThread-0
actually i m doing this to pass one object to the 2 different threads that's why i did it in this way
any more help plz
public class t
{
public static void main (String []args)
{
Byte b1 = new Byte("127");

if (b1==b1) // l
//if(b1.toString() == b1.toString()) //2
System.out.println("True");
else
System.out.println("False");
}
}

strange behaviour
result true if 1 is commented and 2 is used result is false
any expalination
plz
can any body tell me the difference between j2ee and java sdk
plz
thanx
kashif
23 years ago
no fellow this api only shows that these methods are avaialabe and tells than this method does this but does not tell us how method do this and what method callls other method who performs this
some other link plz
kashif
public class ethread extends Thread
{ int x;
int y;
public static void main(String []args)
{
ethread et=new ethread();
Thread a=new Thread(et);
Thread b=new Thread(et);
a.start();
b.start();
}
public void run (){
for (int i=0;i<10;i++)
{//line 1
x++;
y++;
System.out.println("x"+x+"y"+y+"CurrentThread"+getName());
}
}
}
the reuslt is like blew what i m not sure is where is the second thread
2:
what if i wish to synchronize it like
synchronize(this){ //after line 1
but it gives me error
any help

x1y1CurrentThreadThread-0
x2y2CurrentThreadThread-0
x3y3CurrentThreadThread-0
x4y4CurrentThreadThread-0
x5y5CurrentThreadThread-0
x6y6CurrentThreadThread-0
x7y7CurrentThreadThread-0
x8y8CurrentThreadThread-0
x9y9CurrentThreadThread-0
x10y10CurrentThreadThread-0
my question is basic one when we find some method in api for example say getInset in Panel class how do i know what this method do(in detail ) and how to use it (example) api only says like
getInsets
public Insets getInsets()
Determines the insets of this container, which indicate the size of the container's border.
A Frame object, for example, has a top inset that corresponds to the height of the frame's title bar.
Returns:
the insets of this container.
Since:
JDK1.1
any help to use of like these
kashif
Respected fellows
by the grace of God i have manged to pass scjp thoug not with great scord yet passed (only prepared in less than two months without any help/teacher except u people and books).
i would like to thank u people specially maha and others as i learned all(what i know) from u people and all credit go to u people .
exam is not very tough except 2 question from thread .
rhe is sufficient but only 4 passing exam and i/o is only about constructers .
thanx again
kashif

[This message has been edited by kashif sohail (edited January 26, 2001).]
23 years ago
import java.awt.*;
import java.applet.Applet;
public class tcenter extends Applet
{
public void init(){
setLayout(new BorderLayout());
Panel p2=new Panel();
p2.add(new Button("n"),BorderLayout.NORTH);
p2.add(new Button("s"),BorderLayout.SOUTH);
Panel p =new Panel();
p.setBackground(Color.white);
this.add(p,BorderLayout.CENTER);// 1
p.add(p2,BorderLayout.CENTER);
}
}
what is this refer to in line 1 as if i replace it with tcenter it gives me error
2: why the result is like flow layout i.e. two buttons appearing in center not on north and south