About 435,000 results
Open links in new tab
  1. java - How to call a method with a string - Stack Overflow

    You'll need to use java Reflection to do this. See: Class.getMethod() Using your specific example: String text = "Test"; Kyle k = new Kyle(); Class clas = k.getClass(); // you'll need to handle …

  2. How do I invoke a Java method when given the method name as a string?

    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 String return value. It's a getter for a Java …

  3. How to Call a Method in Java? - GeeksforGeeks

    Dec 15, 2024 · Calling a method allows to reuse code and organize our program effectively. Java Methods are the collection of statements used for performing certain tasks and for returning …

  4. Java Methods - W3Schools

    Call a Method. To call a method in Java, write the method's name followed by two parentheses and a semicolon; In the following example, myMethod() is used to print a text (the action), …

  5. How do I invoke a Java method when given the method name as a string?

    To invoke a Java method when given the method name as a string, you can use reflection. Reflection is a feature of the Java language that allows you to inspect and manipulate classes, …

  6. How to Call a Method in Java - CodeGym

    Dec 8, 2021 · To call a method in Java, simply write the method’s name followed by two parentheses () and a semicolon (;). If the method has parameters in the declaration, those …

  7. String (Java Platform SE 8 ) - Oracle Help Center

    The class String includes methods for examining individual characters of the sequence, for comparing strings, for searching strings, for extracting substrings, and for creating a copy of a …

  8. Methods in Java - Baeldung

    Jun 11, 2024 · Learn all about methods in Java, from basic method syntax to overloading, as well as how to call methods.

  9. How to Call a Method in Java - Tpoint Tech

    In this section, we will learn how to call pre-defined, user-defined, static, and abstract methods in Java. In Java, a static method is a method that is invoked or called without creating the object …

  10. How to call a method by name (String) in Java? - Stack Overflow

    Sep 10, 2013 · Java reflection API provides you a way, where a Method type of object could be passed along with the target object and then the method could be invoked on the target object. …

  11. Some results have been removed
Refresh