public class GAME {

	
	boolean gamestatus = true;
	
	double amounts[] = {0, 0.01, 0.5, 1, 5, 10, 11, 14, 20, 300, 600, 150,
			13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 28 };
	
	Briefcase briefcase[] = new Briefcase[27];
	
	public void casesSetup(){
		for (int i = 0; i < briefcase.length; i++) {
			briefcase[i] = new Briefcase();
			double value = amounts[i];
			briefcase[i].setAmount(value);
			briefcase[i].setFace(i);
		}
	}
	
	public void showCases(){
		
		for (int a = 1; a < briefcase.length; a++) {
			if (briefcase[a] == null) { //skip this block

			} else {
				System.out.print("\t" +briefcase[a].getFace() + " ");
				if (a % 5 == 0) {
					System.out.println();
				}
			}
		}
	}
	public void showMEssage(){
		System.out.println("Butsecks");
	}
	
	public static void main(String[]args){
			GAME dnd = new GAME();
			dnd.showMEssage();
			dnd.showCases();
	}
	
}

why is that the showMEssage() method is showing it's message while showCases(); method cannot?

Recommended Answers

All 6 Replies

Add some printlns to the showCases method to display the values of the variables that control whether it prints or not.

Add some printlns to the showCases method to display the values of the variables that control whether it prints or not.

I am trying to print out the faces of my Briefcase object , and there's already printlns on it look

public void showCases(){
		for (int a = 1; a < briefcase.length; a++) {
			if (briefcase[a] == null) { //skip this block

			} else {
				System.out.println("\t" +briefcase[a].getFace() + " ");
				if (a % 5 == 0) {
					System.out.println();
				}
			}
		}
	}
	pub

You need more printlns for debugging.

Add a println at line 4 to show the value of a.
Add a println before line 2 to show the length of the array

You need more printlns for debugging.

Add a println at line 4 to show the value of a.
Add a println before line 2 to show the length of the array

Okay, I've Fixed lol, I didn't initiate my objects! Silly me!

I suspect that 27 "null" messages were printed.

I suspect that 27 "null" messages were printed.

No, no results are showing thats it lol

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.