---
title: "How many string objects are created?"
author: "standalone"
date: "2013-06-01T10:18:48Z"
tags: []
categories: ["编程语言"]
slug: "how-many-string-objects-are-created"
draft: false
lastmod: "2013-06-01T10:18:48Z"
id: 1880859
url: "https://standalone.iteye.com/blog/1880859"
---

This is a very common java interview question. 

Given the following:

String x = new String("xyz");

y="abc";

x=x+y;

How Many Strings have been created:

A - 2

B - 3

C - 4

D - 5

To answer this question, I suggest you to read

<http://www.javaranch.com/journal/200409/Journal200409.jsp>