Access to method of another class in the same package is not possible
This code is not valid Java, you cannot call a method from the body of a class, a method call has to be part of some kind of initializer (such as a static field initializer or static block) or a method.
public class test {
csvReader.updateCSV(...);
}
Can I call a static method of one class in another class under same package?
You can call a method with the syntax ClassName.methodName()
if the method is declared static
, eg
class ClassName {
static void methodName() {
//...//
}
}
More info about static class members can be found in the Java Tutorials.
Related Topics
Differences Between "Java -Cp" and "Java -Jar"
Byte Array and Int Conversion in Java
In a Switch Statement, Why Are All the Cases Being Executed
Uses for the Java Void Reference Type
How to Get a Value from the Last Inserted Row
Sharing Session Data Between Contexts in Tomcat
Spring MVC + JSON = 406 Not Acceptable
Best Way to Get Geo-Location in Java
No Dialect Mapping for Jdbc Type: 1111
Exception Handling:Throw, Throws and Throwable
Convert a Date Format in Epoch
How to Add a Utf-8 Bom in Java
How Does Java's Preparedstatement Work
Java.Util.Zip - Recreating Directory Structure
Multiple Input in Joptionpane.Showinputdialog