How to access arrays from other class in Java? -


i need in accessing array different class can change values in different class.

public class a320ticketorderflorida extends javax.swing.jframe {     static boolean a320floridabusinessa[]=new boolean [6];     static boolean a320floridabusinessc[]=new boolean [6];     static boolean a320floridabusinessd[]=new boolean [6];     static boolean a320floridabusinessf[]=new boolean [6];     static boolean a320floridacoacha[]=new boolean [32];     static boolean a320floridacoachb[]=new boolean [32];     static boolean a320floridacoachc[]=new boolean [32];     static boolean a320floridacoachd[]=new boolean [32];     static boolean a320floridacoache[]=new boolean [32];     static boolean a320floridacoachf[]=new boolean [32]; 

how can access arrays in class ticketrefund.java class change values of array?

the simplest solution make arrays public, such

public static boolean a320floridabusinessa[] = new boolean[6]; 

then access writing a320ticketorderflorida.a320floridabusinessa

however, in general bad practise have shared mutable static variable, perhaps should think migrating these static fields non-static fields. have pass a320ticketorderflorida instance ticketrefund. may worth considering refactoring these arrays shared object shared between a320ticketorderflorida , ticketrefund.


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -