i got a problem wana display my String but it doesnt work


here is my code i dont understand why it doesnt print me anything.....

class StringDemo
{
public static void main(String[] args)
{
String s1,s2,s3,output;

s1=new String("hello");
s2=new String("hello guys");
s3=new String("happy birthday");

output="s1 = " +s1+ "\ns2 = " +s2+ "\ns3" +s3+;

}
}

help me not getting s1,s2,s3

Recommended Answers

All 4 Replies

1. Applying text formatting on your post doesn't help you to get positive attention, so please do not use bold and italic formatting to make your post something special. Use it only to highlight important part in problem description not whole post
2. Use of code tags would be nice
3. Use of full English is expected
4. If you added System.out.println(output); you would see your combined string

ur code will not compile .... remove last '+' from your last line
ie remove below line
---------------------------------------
output="s1 = " +s1+ "\ns2 = " +s2+ "\ns3" +s3+;
-------------------------------------------
with

output="s1 = " +s1+ "\ns2 = " +s2+ "\ns3" +s3;

class stringdemo
{
 public static void main(String[] args)
 {
  String s1,s2,s3,output;
  s1 = "hello";
  s2 = "hello guys";
  s3 = "happy birthday";
  output = "s1="+s1+"\ns2="+s2+"\ns3="+s3;
  System.out.print(output);
 }
 /*
 *By FlamingClaw.2010.04.05.Hungary
 */
}

thnx man for help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.