About 4,280,000 results
Open links in new tab
  1. Java Variables - W3Schools

    To create a variable, you must specify the type and assign it a value: Where type is one of Java's types (such as int or String), and variableName is the name of the variable (such as x or …

  2. java - How to including variables within strings? - Stack Overflow

    you can use String format to include variables within strings. i use this code to include 2 variable in string: String myString = String.format("this is my string %s %2d", variable1Name, …

  3. Java Strings - W3Schools

    Create a variable of type String and assign it a value: String greeting = "Hello"; Try it Yourself »

  4. Java Strings - GeeksforGeeks

    May 6, 2025 · There are two ways to create a string in Java: Syntax: <String_Type> <string_variable> = “<sequence_of_string>”; 1. String literal (Static Memory) To make Java …

  5. How to declare a String in Java? - IncludeHelp

    Sep 22, 2016 · There are many ways to declare a String Object in Java programming language. str ="Hello World!"; System. out. println ("String is: " + str); } } String is: Hello World! public …

  6. Learn How to Declare String in Java with Examples - Edureka

    Feb 13, 2025 · There are two ways to create a String object: By string literal : Java String literal is created by using double quotes. By new keyword : Java String is created by using a keyword …

  7. Java String (With Examples) - Programiz

    In Java, a string is a sequence of characters. For example, "hello" is a string containing a sequence of characters 'h', 'e', 'l', 'l', and 'o'. In this tutorial, we will learn about strings in Java …

  8. Java Variables - GeeksforGeeks

    Apr 24, 2025 · How to Declare Java Variables? The image below demonstrates how we can declare a variable in Java: From the image, it can be easily perceived that while declaring a …

  9. java - Creating a variable name using a String value - Stack Overflow

    Dec 26, 2011 · If you want to give a variable a "name" consider giving the class a name property: class Dog { private String name; public Dog(String name) { this.name = name; } public String …

  10. How to Declare & Initialise a String in different ... - GeeksforGeeks

    Nov 11, 2023 · To declare and initialize a string in different programming languages, you can use language-specific syntax and functions. Below are examples in C++, C#, Python, JavaScript, …

Refresh