Hi.
I wanted a thing like I declare a variable: String a = "test";
And want to know what type it is, i.e., the output should be java.lang.String
thanks in advance
What is the best procedure for storing and retrieving, using native Java serialization, generic objects like ArrayList<String>?
Edit: To clarify. When I serialize an object of type ArrayList<String> I'd like to de-serialize to the same type of object. However, I know of no way to cast back to this generic object without causing warnings.
Using JNI can we pass custom data types from Java to C (or vice versa)? I see a mapping of primitive datatypes to types in C however not too sure if we can send across our own data types (e.g. Send across or return an Employee object or something!).
Does anyone overload the equals method in java? The overloaded method will be
public boolean equals(final MyClass myClass)
This will have the benefit of having the relevant comparison part (guts of the method) in another method.
Details are in this blog.
I know in Jython you can do
import java.util.Random as Random
Random().nextInt()
But if I have a class I wrote myself, how can I import it into Jython without putting the class itself in a package? If I have a testclass Test:
public class Test {
public void foo() {
System.out.println("bar");
}
}
that's not inside a package. Can I even import that into jython by using something along the lines offrom Test import Test?
Having played with Linq (to SQL and Objects) as well as the Entity Framework from Microsoft recently, I was wondering what the non-.Net (specifically Java) equivalents are?
In my code I am using java.sql.PreparedStatement.
I then execute the setString() method to populate the wildcards of the prepared statement.
Is there a way for me to retrieve (and print out) the final query before the executeQuery() method is called and the query is executed? I Just want this for debugging purposes.
Thanks.
This problem occurs over and over. I have some complicated object, such as a Cat, which has many properties, such as age, favorite cat food, and so forth.
A bunch of Cats are stored in a Java Collection, and I need to find all the Cats that are aged 3, or those whose favorite cat food is Whiskas. Surely, I can write a custom method that finds those Cats with a specific property, but this gets cumbersome with many properties; is there some generic way of doing this?
Hi,
I'm not quite sure what field to use when adding more than 30 days to a Java Calendar object. Is there any difference in between Calendar.DAY_OF_MONTH and Calendar.DAY_OF_YEAR?
Example:
GregorianCalendar d = new GregorianCalendar();
d.add(Calendar.DAY_OF_YEAR, 90);
vs
GregorianCalendar d = new GregorianCalendar();
d.add(Calendar.DAY_OF_MONTH, 90);
Thanks.
Hello,
I am writing a user defined function to DB2 on AS/400 in Java and the strangest thing happen..
I am always getting the same result from the function even when i am changing it, even if i am dropping it and create it again and even when i specify NOT DETERMINISTIC..
Does any one have ever encountered a behavior like that?
I need to use a few Cyrillic characters in a Java file and in order for Eclipse to allow me to do so I need to change the encoding for that file (currently to UTF-8).
Are there any possible problems that this could cause?
How would one go about proving to management that a batch reformat of all .java files in a large code base (to place the code in compliance with the company's coding standards) is safe and will not affect functionality.
The answers would have to appease the non-technical and the technical alike.
If i make java core dump with gcore then what is the best tool to analyze it? I need to be able make jmap, jstack, jstat etc and also i need to see values of all variables.
Something that can take core dump as frozen JVM.
Hi,
After some serious googleing I found out that the RandomAccessFile-class is not thread-safe. Now I could use one semaphore to lock all reads and writes but I don't think that performs very well. In theory it should be possible to do multiple reads and one write at a time.
How can I do this in Java? Is it possible at all?
Thanks!
I have a Java application complied to a collection of jars that I want to make installable on Ubuntu and SuSE. I Want the installer to be able to check for the JRE, register a file association and be able to load a website on un-install.
I understand Ubuntu and SuSE are based on different architectures, so is there a consistent way to do this?
Does anyone have an advice on utilities to use or guides to read to help me achieve what I'm trying to do.
Why is it that in Java, a superclass' protected members are inaccessible by an indirect subclass in a different package? I know that a direct subclass in a different package can access the superclass' protected members. I thought any subclass can access its inherited protected members.
Hello.
I develop application with Java.
I need to store some initial configuration data in some kind of file.
I want my app to be able to read this data, but I don't want user to do so.
Example : application loads IP from encrypted file. User sees like "dsda@#21da@" so he won't bother doing anything :)
How should I do such a thing?
Thanx!
Basically I want to be able to encrypt and decrypt with AES 256. What is the industry standard library for encryption in Java? Something that has been around a long time and is tried and true.
Hi,
I have a lot of experience in C and Python, but I'd like to pick up some Java. I was curious if there was a "quick and dirty" guide tailored for people with previous CS background. I'd prefer free online resources but appreciate any suggestion.
Thanks,
Brian
Hi,
I'm a beginner in java. I want the logic of the small program.
I have two arrays
array = {a1,a2,a3,a4,a5,,,,,,,,,an}
and
array2 = {b1,b2,b3,b4,,,,,,,,,,,bn}
I want string as:
a1b1,a2a3b2b3,a4a5a6b4b5b6,..........an
Please tell me what will be the logic.
Is there a way in Java to find the "Last Fired Time" from a Cron Expression.
E.g. If now = 25-Apr-2010 10pm, cron expression "0 15 10 ? * *" (quartz) should return me 25-Apr-2010 10:15am
I do not care if we use standard cron expressions (like Unix and Quartz) or less popular ones if they can fetch me the correct "Last Fired Time"
I have been working with the Swing library for a long time, I'm working on a new project for school and due to the nature of the program it can't look like a generic/boring swing gui. So my question is does anyone know of an interesting java gui library that is not swing or awt?
I have to burn a java-application on a cd. This application have to run on every windows pc wihtout any installation (also jre shouldn't be installed) before.