sreedevi langoju wrote:Hi,
I am preparing for the OCAJP8 certification.While taking the mock exams i found this question.
Here when this break z; statement will get execute ? If not will it become unreachable statement which gives compilation error ?
when i run this program in eclipse it is running successfully .output: 3567
Thanks in advance,
Sree
s ravi chandran wrote:Hi,
I am a java programmer with 7 years of development experience. I wish to join some open source project to learn more and to contribute to some projects that are under development.
I have most of my experience in core java and Middleware programming. How and where should I search for such projects.
Thanks
dipti zone wrote:I have cleared Oracle Certified Professional Java Programmer exam (OCPJP). Oracle is giving me some offer for the higher level exam. Shall I take Oracle Certified Web Component Developer (OCEJWCD) or any higher version of Java like OCPJP8(JDK1.8).
neerav arora wrote:Could anyone please help me in Question number 20 at the following link webpage . How can there be more than two A's,B's,C's in the output ?
jon ninpoja wrote:hi guys,
wrote a simple bridge length program that only lets you create a bridge no less than 20m up to 150m using
accessors and mutators...
here is the code:
i removed "this" from:
this.bridgeLength = bridgeLength;
now it always gives me 0 as the value...im sure its pretty simple (and i prob should know this by now)
what value is the .this giving the variable
from what i read...this will use the instance variable instead of the local one right?
but i thought nothing was assigned to the local variable,its just declared...is that why it gets 0
think im confused:
local variables are assigned null,0 if no assignment right? is it instance variables that wont give a default value?
thanks
Rajeev Srikhar wrote:Thanks for replying, actually I got the ResultSet by using Stored Procedure like you mentioned. But I'm curious to use cursors in stored procedures and retrieve Result set data in java program.
Dipanjan Pramanik wrote:A bluej java program to print the position of the character which has double letters......
Example: Little star shinning bright
It is tt and nn
here is my program:
import java.io.*;
class Abc
{
static void main() throws IOException
{
BufferedReader obj= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Input a String");
String s= obj.readLine();
s=s+" ";
for(int i=0;i<(s.length()-1);i++)
{
System.out.println("The chars to check:"+s.charAt(i)+" "+s.charAt(i+1));
if( s.charAt(i)== s.charAt(i+1))
{
System.out.println("The position of the character is:"+(s.indexOf(s.charAt(i+1))));
}
}}}
Mike Curwen wrote:I'm looking for advice on the best approach to a problem like the following. I have an object that is responsible for retrieving rows from a database and doing quite a bit of processing for each entry. It also does further queries for each row, does a bit of templating and merging, potentially generating an email. Right now, the object just takes the selection criteria in the form of a key; work on all the rows that have 'this' value in the status field.
What if my rowcount is in the thousands? Right now it's just hundreds, and a single thread takes an acceptable amount of time. Eventually, I'm going to click a button, and it will take all night. So I want to multithread this...
My questions is.. where do the threads go?
1)
Should I produce a 'Manager' object? Move the overall query from the existing class into this manager object, turn it into a SELECT COUNT(*) rather than SELECT *, have it divide by the 'maxThreads', and then instantiate 'maxThreads' instances of my (now slightly modified) processing object. Each modified object would then work on its own subset of rows. The only change in the existing processor object (I think) is the method signature would be two long ids, rather than one and the query would change from SELECT * where status=id to SELECT * where row_id between first_id AND last_id. Otherwise, all the code remains the same.
2)
Forget the 'Manager' and simply implement threads within the existing class?
Is there a best practice here? Is there a better idea?
hmm... I just thought better of this. While currently, my rows are pretty much always in a contiguous block, this is not a guarantee. And the way MySql does LIMIT is not safe either:
If you use LIMIT # with ORDER BY, MySQL will end the sorting as soon as it has found the first # lines instead of sorting the whole table.
So I think I need to retrieve all the PK's and stuff them into a List. Then send sublists into the processor object. Yes?
[ December 31, 2003: Message edited by: Mike Curwen ]
Harish Shivaraj wrote:Hi all.
Im asking things,because im not sure if this is a best practice or how would you do it?
I have a database called Vehicle and query the database using JDBC. I have wrapper around the JDBC library such that every time i do a select on the table it return me a list of object with each object corresponds to a row in the table.
I mean this
Table - Vehicle
Select method
public ArrayList<Vechile> Select(...) { .. }
Would you do it this way or would you just return the ResultsSet? I found it much neater when ? I return the Vehicle object where each row data is content within an object.
Thanks
Peter Park wrote:Beginner here,
This is from another thread: https://coderanch.com/t/245950/certification/Exam-Prep-post-increment I read but I could not understand what the JMM125.i on the last line of code means. Especially that period between the JMM125 and i. What does it do to make it come out as a 3?
Explanation? Thank you!
Product:
1
2
1
2
0
1
3