493 Answered Questions for the topic Java
Java
04/10/19
Get an OutputStream into a String?
What's the best way to pipe the output from an java.io.OutputStream to a String in Java? Say I have the method:
writeToStream(Object o, OutputStream out)
Which writes certain data from the object...
more
Java
04/06/19
Any 3D geometry algorithms library in Java?
I need a library, that could perform some geometry operations with objects in 3D, like:
- Find min distance between 2 triangles
- Intersect two polygons
- Intersect to objects and exctract...
more
Java
04/05/19
How do I get a platform-dependent new line character?
How do I get a platform-dependent newline in Java? I can’t use `"\ "` everywhere.
Java
04/05/19
Java - escape string to prevent SQL injection?
I'm trying to put some anti sql injection in place in java and am finding it very difficult to work with the the "replaceAll" string function. Ultimately I need a function that will convert any...
more
Java
04/05/19
Creating a triangle with for loops?
I don't seem to be able to find the answer to this-
I need to draw a simple triangle using for loops.
*
***
*****
*******
*********
I can make a half triangle, but I don't...
more
Java
04/05/19
What does the Java assert keyword do, and when should it be used?
What are some **real life examples** to understand the key role of assertions?
Java
04/05/19
java.util.Date vs java.sql.Date?
`java.util.Date` vs `java.sql.Date`: when to use which and why?
Java
04/05/19
How do I pass in a polynomial function in java?
For a programming project in Calculus we were instructed to code a program that models the Simpson's 1/3 and 3/8 rule.
We are supposed to take in a polynomial(i.e. 5x^2+7x+10) but I am struggling...
more
Java
04/04/19
When do you use Java's @Override annotation and why?
What are the best practices for using Java's `@Override` annotation and why? It seems like it would be overkill to mark every single overridden method with the `@Override` annotation. Are there...
more
In Java XOR with three true inputs returns true. Why?
The following code
System.out.println("1 0 0: " + (true ^ false ^ false));
System.out.println("1 0 1: " + (true ^ false ^ true));
System.out.println("1 1 0: " + (true ^ true ^ false));
...
more
Java
04/04/19
3D Sphere OpenGL?
I would like to create a Sphere, actually a globe. But i can't seem to find any helpful information about how to handle the vertices and indices to a sphere, how to set them up. Could any of you...
more
Java
04/04/19
How do I remove repeated elements from ArrayList?
I have an `ArrayList`, and I want to remove repeated strings from it. How can I do this?
Java
04/03/19
How to determine an object's class?
If class `B` and class `C` extend class `A` and I have an object of type `B` or `C`, how can I determine of which type it is an instance?
Java
04/03/19
How to convert byte size into human readable format in java?
How to convert byte size into human-readable format in Java? Like 1024 should become "1 Kb" and 1024*1024 should become "1 Mb".I am kind of sick of writing this utility method for each project. Are...
more
03/27/19
Is this a good test for a selenium developer?
My boss has given me the assignment of interviewing one of the new automation engineers. The only task left is the technical one, and I have been thinking about a good test that I could give...
more
Java
03/26/19
The Use of Multiple JFrames: Good or Bad Practice?
I'm developing an application which displays images, and plays sounds from a database. I'm trying to decide whether or not to use a separate JFrame to add images to the database from the GUI. I'm...
more
Java
03/26/19
In Java, how do I check if a string contains a substring (ignoring case)?
I have two strings, str1 and str2. How do I check if str2 is contained within str1, ignoring case?
Java
03/26/19
Determining the quadrant of a point?
I need to determine the quadrant of point, in a faster way. I am only aware of "determine using the signs" method. I am looking for a good approach, if any. If not any fixes to my code would help....
more
Java
03/26/19
String concatenation: concat() vs "+" operator?
Assuming String a and b:
a += b
a = a.concat(b)
Under the hood, are they the same thing?
Java
03/26/19
How can I increment a date by one day in Java?
I'm working with a date in this format: `yyyy-mm-dd`. How can I increment this date by one day?
Java
03/19/19
Centroid of convex polyhedron?
I have a closed convex polyhedron which is defined by an array of convex polygons (faces) which are defined by arrays of vertices in 3D space. I'm trying to find the centroid of the polyhedron,...
more
03/19/19
What are good resources for a manual tester to transition to automation?
Nervously looking at job posts, automation and programming is no longer "good-to-have". It is almost a must.
I'm a manual tester looking to start working towards automated testing/test automation....
more
Java
03/19/19
What is difference between CrudRepository and JpaRepository interfaces in Spring Data JPA?
What is the difference between `CrudRepository` and `JpaRepository` interfaces in Spring Data JPA? When I see the examples on the web, I see them there used kind of interchangeably. What is the...
more
Still looking for help? Get the right answer, fast.
Ask a question for free
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Find an Online Tutor Now
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.