Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!

ven kaar

Ranch Hand
+ Follow
since Nov 01, 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 ven kaar

I Guess
\b \r \n \t \f \' \" \\ are the valid excape sequence in java, rest are invalid ??? hope the below helps

http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html

3.10.6 Escape Sequences for Character and String Literals
The character and string escape sequences

\u000a line feed
\u000d carriage return
I think the below is not true!!!

The usage of static variable in a method voilates the contract of static. they are class variables which are initialized on class loading.



but the below is correct

local variables could not have any access type except final



if it is final u cannot reassign the value ???

try using other specifiers(public, private....transient etc and see for results)
Object o is actually holding the reference of Foo, new Foo(), so there is no issues, it will compile and run
I think it is a better way of figuring out things, its an awesome answer TILO

However, a subclass can declair the method with same
name, same return type and similar parameters but
that would be seperate subclass method and not the
oevrriding method.




I feel Sanjay is correct, plse run the below by uncommenting super.call()



does that make some sense ???
me too...

is there any short-cut to accomplish this ???
I think the code does not compile at line 5, its Object not object
First my congrats to Gagan, also would request him to be active on this forum so as it be will be helpful for guys like me and others.

String s1 = "abc";
one object is created at compile time, resides in pool

String s2 = new String("xyz");
two objects are created at compile time, resides in pool and nonpool

s2 = s1;
as the reference is changes , the nonpool reference is eligible for gc

s1.toUpperCase();
one object is created at runtime, is in pool

String s3 = "abc";
already object is in pool

String s4 = s3.replace('a','A');
one object is created at runtime, is in pool

so my answer is 5 is created and one is gc, so finally 4.

there is a lot of discussion on the same subject, i have provided a link already discussed.


https://coderanch.com/t/252556/java-programmer-SCJP/certification/string-function


really it is still unclear, may be the person(Ernest Friedman-Hill) involved in the previous discussion can provide more details, and as requested K&B also ??

are u guys hearing, it would be of good help if someone of u answers

thanks in advance
int i = 5;
int j = 5;
arr[i++] = ++i+(j=i)+i++; //1

arr[i++] = (++i)+(j=i)+(i++); //1

arr[i++] is arr[5] but i value is 6
(++1) is value is 7
(i++) value is 7 but i value is 8

arr[5] = 7 + 7 + 7;// final value is 21

hope this helps ??
it is a general practice to test conditions like the below

if("abc".equals(getValue())){
}

means.,

<constant>.equals(<some variable>

and not

<some variable>.equals(<constant>
Mutiple:
1) Compile time error caused by protected constructor
as long as both the classes are in same package - no issues
2) Compile time error caused by amethod not declaring Exception
down the hierarchy, exception are restrictive - no issues
3) Runtime error caused by amethod not declaring Exception
same as above
4) Compile and run with output of "Pausing" and "Continuing" after a key is hit
the answer is 4.
choice 4 is correct, first it prints 'Pausing', bcos of 'System.in' it expects some input and then finally prints Continuing.

does this make some sense ??
I actually intended a request, may be my English was poor... would love to insert 'Please' into my request...

Generally i try hard to understand the question first...

Thanks Micheal...
Credit goes to the respective author, i have just put a link ..