Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Enge Chall

Ranch Hand
+ Follow
since Nov 22, 2005
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 Enge Chall

Hi,
Is there anyway or any open source to use for maintaining logging codes separate from business code ? Without using spring framework please.
I want to log not only the entry and exit point of a method call, but also in between the codes of a method.

appreciate any suggessions......

thanks.....

Originally posted by Stefan Wagner:
Is there a line at the top, indicating for which shell it is written, like

#!/bin/bash
#!/bin/ksh

?
Did you remove some linebreaks?



It's ksh(#!/bin/ksh) and Assuming the case statement is getting executed what would be the output? is "#" is treated as comment here ? bit skeptical about it.
[ February 03, 2006: Message edited by: Enge Chall ]
14 years ago
Make sure you get the mistake sounds from your external speakers through your sound card. Some times the PC speaker gives the eror sounds, that does not mean it can play your audio devices.
14 years ago
Case "$1" in # "" ) lines=50;; #*[!0-9]* echo "usage: `basename $0`
file-to-cleanup; exit $E_WRONGARGS;; #*) lines=$1;; #esac#

What's the output of the above? It looks simple, but could anyone tell me the exact result ?
14 years ago
Can anyone please reply with the links for mock exams for 1.4 ? thanks in advance
Can anyone explain the mask 022 and 077 in the .profile on AIX.
How to mask and unmask in AIX ?
14 years ago
Thank you one and all for your nice explanations.

Eight of our team members are writing SCJP in the 2nd week of Jan-06.

best regards

Originally posted by peter cooke:

Since I took the beta version of the exam(before knowing anything about webservices), I feel that reading rmh book would have been more useful than either practice exam.

.



What is RMH book ? is this a prescribed book for web services exam ?
Could you please suggest some good books/links to start with ??

Originally posted by Kicky San:
From this thread and by the following example, I am jotting down my observations. Please correct me if i am wrong.

1. static methods can be inherited
2. static methods can be called both by the class name and the class instance
3. static methods cant be overridden. static means one in a class.
4. Even if there is a static method in the child class same as the one in the parent class, it is not the overriden method. It is a seperate method of the child class.

Hope this example will clear all these points.

I have modified the previous example. Here is the modified version

class InheritStaticBase
{
public static void print()
{
System.out.println("I am in base class");
}
}

class InheritStaticChild extends InheritStaticBase
{
public static void print()
{
System.out.println("I am in child class");
}
}

class Main
{
public static void main(String args[])
{
System.out.println("using parent class name");
InheritStaticBase.print();
System.out.println("using child class name");
InheritStaticChild.print();
System.out.println("befre instantiating child class");
InheritStaticChild a = new InheritStaticChild();
a.print();
System.out.println("after instantiating child class");
System.out.println("befre instantiating parent class");
InheritStaticBase b = new InheritStaticBase();
b.print();
System.out.println("befre instantiating parent class");
}
}



Hi Kicky, thank you for the explanation. But according to your theory :

Does it mean that if I have a main() method( ie entry point for execution ) in the Base class,
don't I need to write one more main() method in the sub classes (say I need same logic of main() method for sub classes also) ??? ie

If I run the prog say: java Sub
It must invoke the Superclass main() method if I don't have a main() in the sub class... am I right ?

Originally posted by Arvind Sampath:
2. Does the private method gets inherited to the sub classes ?

No. Private methods are private to the classes in which they are defined. They are not accessible anywhere outside.


3. If the private method is not overridden in the sub class, can we
invoke the private method of the Base class thru sub class object ?
ie sub.supA(); // is it allowed ?


No. Private methods are not inherited by a sub class. Hence, they cannot be overridden neither can they can be accessed using an object of the subclass. Infact, they cannot be accessed outside the class in which they are defined even by using the object of the corresponding class



Arvind[/QB]



If the private methods are not inherited to the subclasses, why does the concept of overriding rules comes into picture like "we can broaden the method scope in the sub classes"

ie if "private" in super class, we can make it "public" in the sub classes ? In fact we are not overriding the method, right ?
These are very trivial doubts.. hope it fits into this forum :roll: !!

1. Does a static method gets inherited to it's sub classes ?

2. Does the private method gets inherited to the sub classes ?

3. If the private method is not overridden in the sub class, can we
invoke the private method of the Base class thru sub class object ?
ie sub.supA(); // is it allowed ?
Thanks
good question dude !! But may not be relevant on this SCJP forum...

please gather the requirements, design, implement, test and deploy !!
[ December 08, 2005: Message edited by: Enge Chall ]
It goes like this :
If you have a +ve number and every time you shift rightgives you a number equivalent to integer division by 2.
ie 4 >> 1 gives(4/2)ie 2, 4 >> 2 gives(4/4) ie 1.

if you do it 32 times right shift gives you the same number ie 4.
ie any multiple of 32(0, 32, 64, 128) also gives you the same number ie 4.

Any number(say n ) above 32, 64, 128..... times shifting gives you (n-32) times right shift.

So 33 means shift (33-32) ie 1. equivalent 4 >> 33 is 4 >> 1.
So 34 means shift (34-32) ie 2. equivalent 4 >> 34 is 4 >> 2.

Simillarly in case of -ve numbers, the sign bit is always 1 and it is stored as 2's complement form.

So shifting more than 2 times -4 ( ie -4 >> 3 ) gives you -1(not zero). other rules being same.
ie -4 >> 32 = -4
-4 >> 64 = -4
-4 >> 33 is -4 >> 1 = -2

not sure about >>> ???
check for 2's complemen calculation link :
https://coderanch.com/t/251801/java-programmer-SCJP/certification/hexadecimal-format

There is a little trick to calculate faster in the exam for -ve numbers:
If it's a odd number let's say (2n + 1) format, then add 1 and devide by 2.. ie your answer in -ve.

ie to get -15 >> 1, answer is -(15+1)/2 = -8
Similarly -16 >> 1, answer is 16/2=8.

Guys, thank me for saving ur binary calculation time
[ December 08, 2005: Message edited by: Enge Chall ]
know the difference between " marker and tagged " interfaces.
You need both depending on the scenario while system designing.

eg: Check interface Serializable, ActionListener provided in java API.