About 26,800,000 results
Open links in new tab
  1. Create new object from a string in Java - Stack Overflow

    Apr 22, 2019 · Is there a way to create a new class from a String variable in Java? String className = "Class1"; //pseudocode follows Object xyz = new className(param1, param2); …

  2. Java Program to Convert String to Object - GeeksforGeeks

    Nov 27, 2020 · Basically, there are two methods to convert String to Object. Below is the conversion of string to object using both of the methods. Method 1: Using the Assignment …

  3. What are different ways to create a string object in Java?

    Feb 2, 2024 · Here, we are discussing two ways to create the string object in Java, By using String Literal; By using new Keyword; Now, we will discuss each way given above in detail …

  4. Convert String to Object in Java - Online Tutorials Library

    May 4, 2023 · Learn how to convert a string to an object in Java with this comprehensive guide, including examples and best practices.

  5. Java Classes and Objects - W3Schools

    Create an object called "myObj" and print the value of x: public class Main { int x = 5; public static void main(String[] args) { Main myObj = new Main(); System.out.println(myObj.x); } } Try it …

  6. Different Ways to Create an Object in Java | Baeldung

    Jan 8, 2024 · In this tutorial, we’ll take a look at some of the different ways we can create an object. In most of our examples, we’ll use a very simple Rabbit object: public class Rabbit { …

  7. How to Convert String to Object in Java Easily | Newtum

    Apr 10, 2024 · How can you convert a String to an Object in Java? You can use casting or the String class’s built-in methods to create objects. What does the `valueOf` method do in …

  8. java - How do you create a String object - Stack Overflow

    Jul 6, 2013 · This syntax creates new String object on every invocation. What that means is, let us say if you have: String stringObj = new String(); String stringObj2 = new String(); String …

  9. 2.1: Using String Objects - Engineering LibreTexts

    Sep 20, 2021 · To create a String object in a program, we first declare a String variable. We then create a String object by using. the new keyword in conjunction with one of the String () …

  10. Different Ways to Create Objects in Java - GeeksforGeeks

    Mar 28, 2025 · Creating objects is one of the most fundamental concepts in Java. In Java, a class provides a blueprint for creating objects. Most of the time, we use the new keyword to create …

Refresh