The Artima Developer Community
Sponsored Link

Java Answers Forum
Sorry... Newbie print question updated

1 reply on 1 page. Most recent reply: Mar 22, 2002 10:24 AM by Bodkins

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
GunNam

Posts: 6
Nickname: gunnam
Registered: Mar, 2002

Sorry... Newbie print question updated Posted: Mar 22, 2002 12:55 AM
Reply to this message Reply
Advertisement
I'm trying to get any of my arrays to print out something. I tried just printing 1 item. What am I doing wrong? Can anyone write some exact code as to how I would make this print out something?



import java.util.*;
import java.awt.*;
import java.io.*;
import java.applet.*;
 
public class SuperMarket extends Applet implements Runnable {
	String [] name = {"Jim","John","Joe","Richard","Paul","Michael","Peggy","Anne","Kathy","Jane","Chris","Noah","Shaina","Jordan","Matthew","Liza","Mila","Dianna","Jean","Andi","Julie","Jimmy"};
	int [] items = {5,5,5,3,3,3,4,4,3,3,4,5,5,4,3,4,3,5,3,3,6,4};
	double [] delay = {100.200,50,300,20,100,150,50,240,150,100,120,350,90,200,100.200,160,300,100,50,100};
 
 
	public void run(){
	}
 
	public void print() {
		System.out.println(name[0]);
	}
	public void main() {
		SuperMarket.print();
	}
}


Bodkins

Posts: 5
Nickname: bodkins
Registered: Mar, 2002

Re: Sorry... Newbie print question updated Posted: Mar 22, 2002 10:24 AM
Reply to this message Reply
You haven't invoked you print function hence nothing got printed out, try putting the print statment in the main method or SuperMarket.print in the class area should run the print statment, i think.

Flat View: This topic has 1 reply on 1 page
Topic: COMBO BOXES Previous Topic   Next Topic Topic: TextListener for JTextArea ???

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use