awais syed

Greenhorn
+ Follow
since Mar 17, 2002
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 awais syed

you set layout before adding componenet to container.because ech layout has its own policy about setting the component and it is done only when the layout set before adding the componet.

Originally posted by madhur jain:
hi!
why is that if i set borderlayout after adding components to the applet nothing is visible.
this is not the case with other layouts.
madhur.

hi,Younes Essouabni
it is explanation part of your question that
"Is there any equivalent in Java or the only way to achieve it is to use the condition if???"
the second part of your question
"And if there is no way, do you have an idea why are we forced to use an int with a switch? I think that a boolean would have been very helpfull, no? ".
the reason of that i give last time that at compile time compiler create a jump table on basis of case label that is not possible if the boolean expresion is used as a case label.
19 years ago
hi all,
in java switch takes a value that may be byte,short,char and int as argument
and up to my knowledge at compile time the compiler construct a jump table on the basis of case labels and this make the excecuting of switch statement fast at runtime.
and there are situations where use of switch is far effective than if structure.

as per your question you use switch rather then if structure using following code.
we write program using

the result od using if structure and switch are same.
[ edited to format code using the [code] and [/code] UBB tags -ds ]
[ June 20, 2002: Message edited by: Dirk Schreckmann ]
19 years ago
in java a class can declare static and non static memebers they can be variables, methods, blocks and classes and also interface(static by default). so any statement that has assignment may come on declaring variables like
class xyz
{
int a = amethod();
public int amethod(){
return 10;
}
}
so in your code if you write it using instance initialization block it will work perfectly
like
[QB]class chkconversion {
class abc {
int k=9;
}
abc a = new abc(),c ;
Object b = a;
{
c = (abc) b; //compile ok
}
}
[ June 09, 2002: Message edited by: awais syed ]
[ June 09, 2002: Message edited by: awais syed ]
19 years ago
because you can not declare method in any method.
but you call this like
[ June 08, 2002: Message edited by: Dirk Schreckmann ]
19 years ago

Originally posted by Christoffer Jeffson:
Stumbled over this at John Hunt's mock exam..

What bothers me is the Test4.this.flag reference. How is it possible to reference "Test4" (class) and then "this" (instance)?


is top level class name Test4 either "kokas"

Originally posted by Asif Masood:
I am bit confused from the different behaviour for almost same expresion.

char ch2 = '2';
char ch3 = '1';
ch3 += ch2; //this works fine

But the following expression gives compiler error.
ch3 = ch3 + ch2;
Why it's so.


because java compiler reads
ch3 += ch2 as ch3 = (char)ch3 + ch2;