GIDForums  

Go Back   GIDForums > Computer Programming Forums > Java Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 01-Nov-2006, 08:53
raslou raslou is offline
New Member
 
Join Date: Mar 2006
Posts: 12
raslou is on a distinguished road

Somebody help with codes for Strings and Arrays


CPP / C++ / C Code:
//One diminsional array of string with 10 elements
class Thirdass
{
    public static void main( String [] args )
    {
		final int SIZE = 10;
		int [] arrayofstring = new int [SIZE];

//Input dialogue box which reads names of 10 people and stores them into the array

readnames[] = {'ben','fred','mark','brian','steve','james','john','david','olivia','diana'}
Last edited by LuciWiz : 01-Nov-2006 at 15:25. Reason: Please insert your C/C++ code between [cpp] & [/cpp] tags
  #2  
Old 04-Nov-2006, 16:35
Justin Fox Justin Fox is offline
Junior Member
 
Join Date: Sep 2006
Posts: 46
Justin Fox is on a distinguished road

Re: Somebody help with codes for Strings and Arrays


JAVA Code:
//One diminsional array of string with 10 elements
class Thirdass
{
    public static void main( String [] args )
    {
		final int SIZE = 10;
		int [] arrayofstring = new int [SIZE];

//Input dialogue box which reads names of 10 people and stores them into the array

readnames[] = {'ben','fred','mark','brian','steve','james','john','david','olivia','diana'}


you need to add...

and in java Strings are notated using "" literals...not ''
'' denotes only a single character..


JAVA Code:



String [] readnames = {"ben","fred","mark","brian","steve","james","john","david","olivia","diana"};




this willl help it compile, but i dont know what you want to do with it...

if you want to sort them, look into implementing interface Comparable



Justin
 
 

Recent GIDBlogI?m Home by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to compare two CString arrays Duke_S MS Visual C++ / MFC Forum 0 04-Oct-2006 15:39
Dynamic vs Static Arrays WaltP Miscellaneous Programming Forum 5 16-Feb-2006 16:54
Noob question on c arrays and functions brett C Programming Language 1 20-Apr-2005 04:59
Knight tour (arrays help needed) dilmv C++ Forum 7 18-Oct-2004 15:31

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 02:37.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.