473,402 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Beginner needing help!

Hi there, I am a complete beginner so apologies if I make not a lot of sense.

What I am trying to do is write a simple class, it has a class array variable named test of type String, ie private String[] test;

I need to write a constructor that will take a string Array as its argument then assign it to the test variable?

I am sure it is very easy, if anyone could help I'd be most grateful

Cheers

Chris
Mar 18 '07 #1
4 1343
horace1
1,510 Expert 1GB
Hi there, I am a complete beginner so apologies if I make not a lot of sense.

What I am trying to do is write a simple class, it has a class array variable named test of type String, ie private String[] test;

I need to write a constructor that will take a string Array as its argument then assign it to the test variable?

I am sure it is very easy, if anyone could help I'd be most grateful

Cheers

Chris
have you used Java Strings?
http://java.sun.com/docs/books/tutorial/java/data/strings.html

why an array of Strings and not a Vector or ArrayList of Strings
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Vector.html
Mar 18 '07 #2
Thanks for the reply.

What if the array was of the integer type?

Basically I need the basic syntax of what I was trying to do regardless of whether or not there is a better way!

An example syntax would be great.

Cheers

Chris
Mar 18 '07 #3
r035198x
13,262 8TB
Hi there, I am a complete beginner so apologies if I make not a lot of sense.

What I am trying to do is write a simple class, it has a class array variable named test of type String, ie private String[] test;

I need to write a constructor that will take a string Array as its argument then assign it to the test variable?

I am sure it is very easy, if anyone could help I'd be most grateful

Cheers

Chris
Expand|Select|Wrap|Line Numbers
  1.  public MyConstructor(String[] array) { 
  2.       test = array;
  3. }
  4.  
Mar 19 '07 #4
Thanks a lot appreciate the help.
Mar 19 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Grrrbau | last post by:
I'm a beginner. I'm looking for a good C++ book. Someone told me about Lafore's "Object-Oriented Programming in C++". What do you think? Grrrbau
14
by: japin0 | last post by:
Hi, I am a absolute beginner in ASP ..I do have a bit of exposure to .VBS and other scripting languages. I need your guidance, where do I start? I had been to MS website Quick start guide but it...
5
by: Jozef | last post by:
Hello, I have done a little "old" ASP work along with some javascript. I'm currently getting into ASP.net and would like to step up my game overall with regard to Web Development. I was...
1
by: hl | last post by:
Hi, I'm a beginner and need a little help with getting data back from a web service. I am using VB.Net and have added a web reference to a Wsdl that was provided to me. My reference.vb file...
7
by: tsivaraman | last post by:
Hi I am a PHP ,MySQL newbie.Just finished learning the basics of PHP programming and MySQL interaction.Can anyone suggest some project topics that will help me gain hands-on experience in...
13
by: Jack B | last post by:
I'm using Access 2002 to create a database for a small opera company that my wife is involved in, and I'm more than a bit rusty because I haven't created a new Access database since about 1999. ...
6
by: robtyketto | last post by:
Greetings, Im a newbie to JSP/Javascript (unfortunalley). However I found enough example to create code that connects to my access db and populates two combo boxes. The selection of the...
10
by: hamza612 | last post by:
I want to start learning how to program. But I dont know where to start. From what I've heard so far c++ is not a good lang. to learn as a beginner because its very complicated compared to others...
22
by: ddg_linux | last post by:
I have been reading about and doing a lot of php code examples from books but now I find myself wanting to do something practical with some of the skills that I have learned. I am a beginner php...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.