Top Posts
Intranet Application Case Studies
Electronic E-commerce and the Trade Cycle
Types of JDBC drivers
C++ Program to implements Constructor Overloading
C++ Program to implements Constructor
C++ Program to calculate the area using classes
C++ Class Program to Store and Display Employee...
Operator Overloading of Decrement — Operator
Postfix Increment ++ Operator Overloading
Top 8 Programming Languages That Will Rule in...
TECHARGE
  • HOME
  • BLOGS
  • TUTORIALS
    • ALL TUTORIALS
    • PROGRAMMING TUTORIALS
      • JAVA TUTORIALS
      • C++ TUTORIAL
      • C PROGRAMMING TUTORIALS
      • PYTHON TUTORIAL
      • KNOWLEDGE MANAGEMENT TUTORIALS
      • DATA STRUCTURE AND ALGORITHM TUTORIALS
      • PROGRAMMING EXAMPLES
        • CPP EXAMPLES
        • JAVA EXAMPLES
        • C++ GRAPHICS PROGRAM
    • PROJECTS
      • PYTHON PROJECTS
      • SWIFT PROJECT
    • PPROGRAMMING QUIZ
    • DBMS TUTORIALS
    • COMPUTER NETWORK TUTORIALS
    • COMPUTER NETWORK SECURITY TUTORIALS
    • E COMMERCE TUTORIALS 
    • AWS TUTORIAL
    • INTERNET OF THINGS
    • CHEATSHEET
  • MORE
    • JOBS AND INTERNSHIPS
    • INTERVIEW PREPARATION
    • TECH BOOK
    • TECH NEWS
    • INSTAGRAM GALLERY
    • UNIVERSITY PAPERS
    • MNC TWEETS
    • THINKECO INITIATIVES
    • WEB STORIES
    • CONTACT US
  • WRITE +
  • ABOUT US
Java Tutorial

Strings in Java

by anupmaurya November 23, 2022
written by anupmaurya 0 comment
1.2K

Int, Boolean, double, char, are primitive data types. These are great for storing a whole number, true/false values, a single letter or symbol, but what if you wanted to store and reference some text, something that requires more than just a single character? 

In this tutorial, we’ll be looking at the second overarching category of Java data types called Reference types. 

what is reference datatype in java?

A reference type is a data type that’s based on a class rather than on one of the primitive types that are built in to the Java language.

Reference data types in java are those which contain reference/address of dynamically created objects. These are not predefined like primitive data types.

Following are the reference types in Java.

  • class types − This reference type points to an object of a class.
  • array types − This reference type points to an array.
  • interface types − This reference type points to an object of a class that implements an interface.

What is string?

A string is a sequence of ordered characters. it is a reference type data type. Before, we could represent a single character with a char, but now we can represent a word or a person’s name with the string data type. 

To create a string, we surrounded the series of characters with quotation marks. This represents a string value. There are two ways to represent a string, both are same but different in approach

String techarge = new String("Java is for everyone");  

String techarge = "Java is for everyone";

Important points

  • String Object is used for holding String of text.
  • Part of java.lang package.
  • Strings can be added by using concatenation Operator(+).
  • Characters use single quotes(‘ ‘) as the delimiter while Strings use double quotes(” “) as delimiters.
  • String objects are immutable. Value of the string object cannot be changed once assigned.
  • String class is final means method of the String class cannot be overridden.
  • All String literals are added to String pool by JVM.
  • String have method length() while Array has a property length to check the length.
  • To overcome the immutable property of String StringBuffer and StringBuilder comes into the picture.
array typescharclass typesdata typesdoubleReference typesstrings in java
Share 4 FacebookTwitterLinkedinRedditWhatsappTelegramEmail
anupmaurya

Hey there, My name is Anup Maurya. I was born with love with programming and worked with TCS. One of best global (IT) services and consulting company as System Administrator . I also love graphics designing. It's my pleasure to have you here.

previous post
How to Check version of Java installed in System ?
next post
C++ Programming Examples

You may also like

Types of JDBC drivers

JDBC Architecture

Introduction to JDBC

Difference Between Applet and Servlet in Java

OOPs Concepts in Java

Constructors in Java

Extending Interface

Implementing Interfaces in Java

Interface in Java

Java AWT tutorial for beginners

Java Tutorial

  • Online Java Compiler
  • Introduction to Java Programming
  • How to Check version of Java installed in System ?
  • How to set Temporary and Permanent Paths in Java
  • Features of Java Programming
  • Java Comments
  • Java Keywords
  • Java Variables
  • Data Types in Java
  • Java Flow Control Statements
  • Bitwise operators in Java
  • Understanding public static void main(string args[]) in Java
  • Strings in Java
  • Final method in Java
  • Constructors in Java
  • Exception in JAVA
  • Exception Handling in Java
  • Arguments in Java with Examples
  • Difference between abstract class and interface
  • Interface in Java
  • Implementing Interfaces in Java
  • Java Event Handling
  • Extending Interface
  • Multithreading in Java
  • Threads in Java
  • Life cycle of a thread in Java
  • Java AWT tutorial for beginners
  • Introduction to JDBC
  • JDBC Components
  • Java Database Connections | JDBC Tutorial
  • DriverManager class
  • Connection interface
  • Statement interface
  • PreparedStatement interface
  • ResultSet interface
  • Java Database Connectivity with MySQL
  • Applet in Java
  • Difference Between Applet and Servlet in Java
  • Web Terminology
  • Servlets
  • Servlet Interface
  • Life Cycle of a Servlet (Servlet Life Cycle)
  • Servlet API
  • GenericServlet
  • HttpServlet
  • Steps to Create Servlet Application using tomcat server
  • Session Tracking Using Servlet
  • Introduction to JSP
  • The JSP API
  • The Lifecycle of a JSP
  • TAGS in JSP

Words from Readers

I Just go mad with this website I love the content and the way it you present I can easily understand anything from this Thank you everyone who are made this possible!

–Paras Singh Kaphalia

Recent Posts

  • Intranet Application Case Studies

    March 21, 2023
  • Electronic E-commerce and the Trade Cycle

    March 21, 2023
  • Types of JDBC drivers

    December 28, 2022

EDUCATIONAL

  • Top 8 Programming Languages That Will Rule in 2023

  • Difference between Google Cloud Platform, AWS and Azure

  • Google Apps You Should Be Using in 2022

  • Top Sites From Where You Can Learn

  • PyScript: Python in the Browser

  • Best Fake Email Generators (Free Temporary Email Address)

  • How to Find Out Who Owns a Domain Name

  • Mobile phone brands by country of origin

  • How to start a new YouTube Channel in 2022

  • Best way to use google search you won’t believe exist

CHEATSHEET

  • Git and Github 2022 Cheat Sheet

  • ReactJs Cheatsheet

  • Linux Commands Cheat Sheet

  • C Programming language Cheatsheet

  • Scala Cheatsheet

  • MySQL Cheatsheet

  • Javascript Cheatsheet

PROJECTS

  • Print emojis using python without any module

  • Country Date and Time using Python

  • Covid-19 Tracker Application Using Python

  • Python | GUI Calendar using Tkinter

  • Shutdown Computer with Voice Using Python

  • Python GUI Calculator using Tkinter

  • Convert an Image to ASCII art using Python

  • Python YouTube Downloader with Pytube

  • Tic-Tac-Toe using Python

  • Draw Indian Flag using Python

  • Drawing Pikachu with the Python turtle library

  • Word Dictionary using Tkinter

TECH NEWS

  • 5+ Best Humanoid Robots In The World

  • Reliance Jio launches streaming platform JioGamesWatch

  • Microsoft Teams down for thousands of users

  • Carbon: Google programming language as a C++ successor

JOBS AND INTERNSHIPS

  • Accenture Off Campus Hiring Drive | Associate Job | Program Project Management | 2019-2022 Batch| Apply Now

    September 1, 2022

@2019-21 - All Right Reserved. Designed and Developed by Techarge

TECHARGE
  • HOME
  • BLOGS
  • TUTORIALS
    • ALL TUTORIALS
    • PROGRAMMING TUTORIALS
      • JAVA TUTORIALS
      • C++ TUTORIAL
      • C PROGRAMMING TUTORIALS
      • PYTHON TUTORIAL
      • KNOWLEDGE MANAGEMENT TUTORIALS
      • DATA STRUCTURE AND ALGORITHM TUTORIALS
      • PROGRAMMING EXAMPLES
        • CPP EXAMPLES
        • JAVA EXAMPLES
        • C++ GRAPHICS PROGRAM
    • PROJECTS
      • PYTHON PROJECTS
      • SWIFT PROJECT
    • PPROGRAMMING QUIZ
    • DBMS TUTORIALS
    • COMPUTER NETWORK TUTORIALS
    • COMPUTER NETWORK SECURITY TUTORIALS
    • E COMMERCE TUTORIALS 
    • AWS TUTORIAL
    • INTERNET OF THINGS
    • CHEATSHEET
  • MORE
    • JOBS AND INTERNSHIPS
    • INTERVIEW PREPARATION
    • TECH BOOK
    • TECH NEWS
    • INSTAGRAM GALLERY
    • UNIVERSITY PAPERS
    • MNC TWEETS
    • THINKECO INITIATIVES
    • WEB STORIES
    • CONTACT US
  • WRITE +
  • ABOUT US