What is the syntax for adding multiple strings to one variable in Java?

Okay the thing i want to do is make a variable like Line = "hey","you",Mom".

Then later I want to be able to call Line 0 and get the string "hey".

I have something like this:

String[] history = new String "hey","you","Mom";

public String getLine(int index)
   if (index < 0 || index >= this.history.length)
       return null;

But this is not working..

How do i make this list? I'm new with the syntax in java.



String[] history = new String[] { "hey", "you", "Mom" };

Need Your Help

Is there a difference between flexible quotes in ruby?

ruby string quotes

I feel I should preemptively apologize because this seems like the type of question that's probably been asked before. I couldn't find an answer so I'm asking here.

How to validate math formular string using regex?

java regex math

I have a textbox to input a mathematical formular inlcude +,-,*,/,(,),TRUNC,ROUND,POWER,MOD,SQRT,FLOOR,DECODE. After user input a formula string, i want to validate this string but i don't know how...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.