Variable gets another value even without assigning values to it

Asked

Viewed 53 times

2

I call a Jframe passing as parameter my variable and there I assign it in another variable I declared in order to be able to do the necessary operations. But when I close the Jframe 2 my variable of Jframe 1 gets the same values.

How can this occur if I don’t return anything?

// Aqui utilizo o método get do recipesTableModel para obter minha variável (Ingredient.class)
ViewDatasheetJFrame frame2 = new ViewDatasheetJFrame(recipesTModel.get(row));
frame2.setLocationRelativeTo(rootPane);
frame2.setVisible(true);
  • I could not understand very well neither the explanation nor the code. Try to show more of the related code. See if this helps: http://answall.com/questions/59437/qual-a-diff%C3%a7a-between-pass-by-pass-by-refer%C3%aancia

  • @I think that’s really it. Because in Frame 2 I change the values of my attributes and when I go back to Frame 1 I realize that the values are changed too. In the post you sent I realized this when he talks about "Passing complex types by value".

  • 1

    Nice, good that my answer there was useful ;-)

1 answer

0


Browser other questions tagged

You are not signed in. Login or sign up in order to post.