Ask your own question, for FREE!
Computer Science 26 Online
OpenStudy (anonymous):

if i make a method "public String Encrypt( File blah, String stuff){" what is the syntax for using it in the main method?

OpenStudy (anonymous):

File file; // initialize this somehow String stuff; // set this to whatever you need String result = Encrypt(file, stuff);

OpenStudy (farmdawgnation):

Well, if this is Java dmancine's answer isn't exactly right. Let's say Encrypt belongs to some class named FooBar. Since main is a static method, you either have to make Encrypt static or create and instance of the FooBar class inside the main method. You have to create the instance of the class *even* if the main method is also in the FooBar class. So to alter dmancine's answer you would have: File file; //init this String stuff; //put stuff here FooBar objFooBar = new FooBar(); //do this because Encrypt isn't static but main is. String result = objFooBar.Encrypt(file, stuff); As I mentioned above if you make Encrypt static, then dmancine's answer will work just fine. But only if you make it static.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!