Consider the following code
private int meth()
{
try
{
return 1;
}
catch(Exception ex)
{
return 2;
}
finally
{
return 3;
}
}
When the aforeseen code is compiled, "Exception" is treated as unchecked exception. That is "unreachable catch block Exception is never thrown in try block" compil...
Hi all,
I am given a task to convert a huge table to custom XML file. I will be using Java for this job.
If I simply issue a "SELECT * FROM customer", it may return huge amount of data that eventually causing OOM. I wonder, is there a way i can process the record immediately once it become available, and remove the record from memory a...
any methods available to stop a JProgressBar at runtime?? i wil start a progress bar wen a button is clicked(which wil start a thread at the back ground). what i exactly want is to stop the progress bar wen a deadlock situation occurs in my program.. This is the gist of my program..
...
Hi all,
I have a string which contains alphanumeric character.
I need to check whether the string is started with number.
Thanks,
...
Hi,
I have been asked to write a java program on linux platform. According to system admin, the JRE on the linux system is GIJ, which is supposed to be compatible to JRE 1.4.2.
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-44)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see ...
hi, all. I need to use java 5 enum in velocity template, so that I could write something like
public enum Level{
INFO, ERROR;
}
Velocity template:
#if($var == Level.INFO)
...
#else
...
#end
How can it be done? Thanks in advance.
...
i have a JTable having many strings in that.i have created a textbox for user entry, above the table. i want a row filter which can remove the rows having strings enterd by the user in the text box. please help me out for this.
...
There's a lot of information out there, but I can't quite figure out:
What's Java's answer to PHP's SoapClient()?
No frills, just want to create a client to access the methods described by a .wsdl document.
...
I am running a UI unit test with multiple scenarios that requires the UI to get focus when it starts. This test runs for a while and I am facing an issue in GNOME desktop where the focus goes back to this application for each scenario it executes; this prevents me from using my machine when this test case running.
This works fine on win...
Hi all,
I have string which contains alpahanumeric and special character.
I need to replace each and every special char with some string.
For eg,
Input string = "ja*va st&ri%n@&"
Expected o/p = "jaasteriskvaspacestandripercentagenatand"
= "asterisk"
& = "and"
% = "percentage"
@ = "at"
thanks,
...
Java - or at least Sun's Hotspot JVM - has long had a reputation for having a very large memory footprint. What exactly is it about the JVM that gives it this reputation? I'd be interested in a detailed breakdown: how much memory goes to the runtime (the JIT? the GC/memory management? the classloader?) anything related to "auxiliary" A...
Is there an open-source Java implementation of the VCDIFF binary diff format (decoder and encoder)?
There are xdelta and open-vcdiff, but those are both C libraries.
Alternatively, are the other formats/algorithms that one could use to generate diffs for binary files from Java?
...
I'm trying to use the @Test(expected = RuntimeException.class) annotation in
order to test for an expected exception. My code is as follows:
@Test(expected = RuntimeException.class)
public void testSaveThrowsRuntimeException(){
User user = domain.save(null);
}
and my save method simple like this :
publ...
I have a problem with debugging sessions. My program executes very well in a debug session but if I start a normal run, it behaves completely different.
The problem is, that I cannot say, why it acts different.
One possible reason is the slower execution time because you alway have to press F6 or so.
I tried to insert Thread.sleep(1000)...
I looked at some demos but did not find any atricles that explain the concept.
Demo link
...
Have you ever had to justify the choice over using .Net instead of Java based on performance?
For a typical high volume transaction processing system that can perform the following operations,
Concurrent Database transactions
Mathematical computations
Interaction with other web services (SOAP/XML, XML-RPC)
My approach would be to co...
I had a heated discussion with a colleague on the usage of stored procedures (SP) in a .NET application (on an SQL server 2005 database). [He has a Microsoft background and I Java - which may or may not be relevant].
I have to insert data captured in the UI. For this I would write a SP and use that in the .NET code? It's not required b...
I have a web archive with a file placed in the WEB-INF directory.
How do I load that file in a java class?
I know I can put it in the classes directory and load it from there. It would just be put it in WEB-INF.
...
I have a question that is a point difference between ModelAndView and ModelMap.
I want to maintain modelAndView when requestMethod is "GET" and requestMethod is "POST".
My modelAndView saved others.
So I made modelAndView return type to "GET", "POST" methods.
But, Request lost commandObject, form:errors..., if request return showForm ...
If we implement our own keys in Hashtable, then our custom hashtable keys must implement
public int hashCode()
{
}
and
public Object equals(Object obj)
{
}
What will be the implementations for these methods?
...