About 460,000 results
Open links in new tab
  1. java - Convert String into a Class Object - Stack Overflow

    I am storing a class object into a string using toString() method. Now, I want to convert the string into that class object. How to do that? Please help me with source code.

  2. How do I compare strings in Java? - Stack Overflow

    Apr 2, 2013 · The Java String class actually overrides the default equals() implementation in the Object class – and it overrides the method so that it checks only the values of the strings, not …

  3. Using the equals() method with String and Object in Java

    Sep 8, 2014 · The equals() Method of the Object class doesn't know how to compare Strings, it only knows how to compare objects. For comparing strings, a string class will override the …

  4. java - How to mock a String using mockito? - Stack Overflow

    48 The problem is the String class in Java is marked as final, so you cannot mock is using traditional mocking frameworks. According to the Mockito FAQ, this is a limitation of that …

  5. java - How to create a class literal of a known type: …

    Jan 6, 2010 · What class literal expression can I return from this method which will satisfy the generics and compile? List.class won't compile, and neither will List.<String>class.

  6. How do I invoke a Java method when given the method name as a …

    Object obj; String methodName = "getName"; Without knowing the class of obj, how can I call the method identified by methodName on it? The method being called has no parameters, and a …

  7. java - Difference between String trim () and strip () methods

    Among other changes, JDK 11 introduces 6 new methods for java.lang.String class: repeat(int) - Repeats the String as many times as provided by the int parameter lines() - Uses a Spliterator …

  8. java - Why can we use String without an import - Stack Overflow

    Oct 31, 2011 · When we use ArrayList or HashMap in Java, we have to import java.util.ArrayList or java.util.HashMap. But when we use String, it doesn't require the import statement. Can …

  9. java - String.equals versus == - Stack Overflow

    String class overrides it to check if two strings are equal i.e. in content and not reference. == operator checks if the references of both the objects are the same.

  10. How to convert the following json string to java object?

    Apr 25, 2012 · It can also be used to convert a JSON string to an equivalent Java object. Gson can work with arbitrary Java objects including pre-existing objects that you do not have source …