Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » I found something what seems different very strange(basic array of char type working not properly)
I found something what seems different very strange [message #1802803] Sat, 16 February 2019 16:10 Go to next message
Andrzej Trzaska is currently offline Andrzej TrzaskaFriend
Messages: 2
Registered: January 2019
Location: Krakow
Junior Member
I couldnt repair my code on Eclipse 2018 12 4.10 with oracle jdk 11 so i decide to install IntelliJ Community IDE from JetBrains with the same Java 11
If We compare that code beetween both IDE in IntelliJ elements of char array was write properly. All work good on it.
On Eclipse in my observation many elements of one dimension basic array doesn't work properly.
Maybe someone with knowledge find issue with that.
//for testing elements in main project
public class Test {
private short z;
private char[] board= new char[9];
private char state,state2,state3;


public Test(short z,char[] board, char state, char state2, char state3) {
	this.z=z;
	this.board=board;
	this.state=state;
	this.state2=state2;
	this.state3=state3;
}

public Test() {
	super();
}

public char test() {
	state='a';
	z=0;
	board[z]=state;
	System.out.println("Wyniki początkowe Test i zmienne zachowują się poprawnie"); //not important
	System.out.println(board[z]+ " : variable state in board[z]");
	board[0]=state;
	System.out.println(board[0]+ " : variable state in board[0]");
	board[0]='a';
	System.out.println(board[0]+ " : value with board[0]='a';");
	board[3]='x'; //found printBoard()
	System.out.println(board[3]+ " : value with board[3]='x';");
	board[8]='y';//value not found in printBoard()
	System.out.println(board[8]+ " : value with board[8]='y';");
	return state;
	
}
public char testWith() {
	if (state=='a' || state=='A') {
		System.out.println("Variable State : "+state);
		z=7;
		state2='b';
		board[z]=state2;
	}
	else {
		z=5;
		state='B';
		board[z]=state2;
	}
	//board[z]=state2;
	if (z==7 && state2=='b') {
		System.out.println("Its working?");
		board[z]=state2;
		System.out.println(" | "+board[7]);
		
	}
	state3='c';
	if (state3=='c') {
		z=4;
		board[z]=state3;
	}
	
		return state3;
}
void printBoard() {
	System.out.println("\n**************************************************************************************************************"
					+ "\n "
					+ "\n | " + board[0] + " | " + board[1] + " | " + board[2] + " | "
					+ "\n |-----------|"
					+ "\n | " + board[3] + " | " + board[4] + " | " + board[5] + " | "
					+ "\n |-----------|"
					+ "\n | " + board[6] + " | " + board[7] + " | " + board[8] + " | "
					+ "\n "
					+ "\n**************************************************************************************************************\n");
	
	
	
	/*System.out.println(" | " + board[3] + " | " + board[4] + " | " + board[5] + " |");
	System.out.println(" |-----------|");
	System.out.println(" | " + board[6] + " | " + board[7] + " | " + board[8] + " |");
	System.out.println(" ");
	System.out.println("\n**************************************************************************************************************\n");
*/
}
public static void main(String[] args) {
	Test obiekt = new Test();
	obiekt.test();
	//Thread.sleep(500);
	obiekt.testWith();
	obiekt.printBoard();
}
}

How to say. I like Eclipse more than Jetbrains.
Regards for All!
Re: I found something what seems different very strange [message #1802926 is a reply to message #1802803] Tue, 19 February 2019 08:20 Go to previous message
Andrzej Trzaska is currently offline Andrzej TrzaskaFriend
Messages: 2
Registered: January 2019
Location: Krakow
Junior Member
Any suggestions?
maybe its good idea to get value for all elements on begining in code?
Previous Topic:Trouble Running Oomph Installer
Next Topic:Eclipse installation
Goto Forum:
  


Current Time: Thu Mar 28 09:46:18 GMT 2024

Powered by FUDForum. Page generated in 0.04253 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top