If you want to pass the variable to another class, pass the variable as an agrument to that class’s method.
Eg:-
Class2 class2 = new Class2();
for(String s : list){
class2.method(s);
}
More Related Contents:
- read line using java & maped filterd data [closed]
- select and delete a record without the information of primary key [closed]
- Does a finally block always get executed in Java?
- Large Numbers in Java
- Passing data through intent using Serializable
- How to execute IN() SQL queries with Spring’s JDBCTemplate effectively?
- Simple popup java form with at least two fields
- Sort a Map by values
- How to create a generic array in Java?
- What operations in Java are considered atomic?
- Preemptive Basic authentication with Apache HttpClient 4
- How can I replace non-printable Unicode characters in Java?
- Stand-alone Java code formatter/beautifier/pretty printer? [closed]
- Shortcut “or-assignment” (|=) operator in Java
- JFreeChart with selectable domain axis and zoom
- Spring 4 – addResourceHandlers not resolving the static resources
- What is LD_LIBRARY_PATH and how to use it?
- Using PDFBox to write UTF-8 encoded strings to a PDF [duplicate]
- How can I read an HttpServletReponses output stream?
- Why is the finalize() method in java.lang.Object “protected”?
- getWindowHandles() not working in firefox 58.The focus remains on parent tab and does not transfer to next tab
- How to execute Python script from Java (via command line)?
- How to draw multiple axis on a chart using JAVAFX Charts
- What if main method is inside “non public class” of java file?
- Fill fields in webview automatically
- Maven docker cache dependencies
- Getting StaleElementReferenceException while trying print the link names
- how to export (JUnit) test suite as executable jar
- Dynamically connecting a Kafka input stream to multiple output streams
- Asynctask: pass two or more values from doInBackground to onPostExecute