Win a copy of Securing DevOps this week in the Security forum!

Sam Cooper

Greenhorn
+ Follow
since Feb 21, 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 Sam Cooper

How can you declare i so that it is not visible outside the package 'test'.
package test;
class Test
{
XXX int i;
/* lot of code */
}
public
protected
friend
no access modifier
private
One of the answer is no access modifier, what is the other possible choice.
Is it public? Does the access modifier of the method override the class modifier.Hope my question makes sense. In other words if declare a method private in public class, the net access permission of the method is public
or is it class modifier overrides the method modifier
Any suggestions are welcome
Thanks
N << x
Can be generalized as N*(2)^x
N >> x
Can be generalized as Mod(N*(2)^(-x))
Is there a generic rule for the N>>>x.
I know this had been discussed heavily, but I tried to search but with little help.
Any help is greatly appreciated.
Thanks
Valentin:
Here is the thread for that
Link
I am planning to take the test in couple of weeks. I am planning to buy JQPlus, but somewhere in this forum I heard that JQPlus has become obsolete. Is that true? Any comments are greatly appreciated.
Thanks
This is question form MarcusGreen's Mock exam 2.
interface IFace{}
class CFace implements IFace{}
class Base{}
public class ObRef extends Base{
public static void main(String argv[]){
ObRef ob = new ObRef();
Base b = new Base();
Object o1 = new Object();
IFace o2 = new CFace();
}
}
1)o1=o2;
2)b=ob;
3)ob=b;
4)o1=b;

My question is under what circumstances the casting from an Interface to Object is possible and vice versa. Any thoughts are greatly appreciated.
Thanks
Can the constructors be marked private or protected or friendly (none). If so whats their significance.
Thanks
Thanks Rajinder:
O or OX declare that it is octal or hexa decimal number but they do not contribute to the value while converting them to the decimal.
Am I right?
I understood how to convert one system of representation to other. Here is an example of converting hexa to decimal.
0x7D
13*16^0 + 7*16^1
13*1 + 7*16
125
But what is the x in 0x7D?,
DOES THAT HAVE ANY SIGNIFICANCE?
Thanks
Sam
Could some one please go over this casting example once again.
Any thoughts are greatly appreciated
Look at the java api, there is good article there on the Deprecated suspend and resume.
Follow this

Deprecated suspend and resume
I MEAN
My initial guess is that you CANNOT call a non static method from a static (main), so this should result in a compile time error. But the answer that was given to be
Complies and runs printing out 2.
Could some on please let me know whats going on here
SAM
I had come across this in a mock exam.
public class Test{
public static void main(String[] args){
int[] a = {1};
Test t = new Test();
t.increment(a);
System.out.println(a[a.length - 1]);
}
void increment(int[] i){
i[i.length - 1]++;
}
}
My initial guess is that you can call a non static method from a static (main), so this should result in a compile tim error. But the answer that was given to be
Complies and runs printing out 2.
Could some on please let me know whats going on here
SAM
"Since string literals in string pool will not be
collected, the answer should be 0 right?"
Holmes, Could you please elaborate your explanation.
Thanks