What is a string?

In programming, a data type used to represent a piece of text instead of a numerical value is called a string. Numbers and special characters, like space, can also be part of a string. In many languages, including Java, a string is enclosed in double quotes (""). The following are some valid strings:

  • "I love Java."
  • "I am 17 years old."
  • "12345"
  • "&*3223"

Get hands-on with 1200+ tech skills courses.