dimanche 27 mai 2018

Program won't print out a string unless another string is printed before it

I have a java program that simulates an interpreter.

When I loop through following commands given to it:

x = 4
y = 10
print x * y
x = x + 1
print x

It should return/print

40
5

But it gives nothing.

Now if I do

System.out.println("whatever here");

Before the actual print command is given, it returns:

whatever here
40
whatever here
5

Has anybody ever had this problem and how should I deal with it?

I can't really post the code because it's in my native language but I can give answers about it if it helps.

Aucun commentaire:

Enregistrer un commentaire