|
-
What is wrong with these codes
Hi
Need help in these
1.How can I Optimize this Java code. Assume all variables have been declared and have the correct data type.
String str = "";
for( int i=0; i < 1000; i++ ) {
str += myStringArray[i];
}
2.
What's wrong with this Java code? Assume all variables have been declared and have the correct data type.
try {
PreparedStatement stmt = conn.prepareStatement( "select top ? my_column from my_table" );
stmt.setInt( 1, myNum );
rs = stmt.executeQuery();
} finally {
conn.close();
}
3.
What is the output of this Java fragment?
int a = 0;
int b = 0;
if( false & a++ > 0 ) {
a = 100;
}
if( false && ++b > 0 ) {
b = 100;
}
Please reply
Regards
System.out.println(a);
System.out.println(b);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks