Note that there are some explanatory texts on larger screens.

plurals
  1. POJava code is not letting me call a method from one class to another
    primarykey
    data
    text
    <p>Hey guys sorry this is a pretty long question but I cannot call printPASSInfo() to another class using pm.printPASSInfo(). pm is the name I named the class that the method I am trying to call is in. I can call the method pm.printSSNInfo just fine I do not understand what is going wrong. I am sorry this is probably confusing and very long but please try to help. Thanks guys! Heres my code:</p> <pre><code>import java.util.Scanner; public class Prog1Methods_FA11 { String ssn, pw, phoneNumber,line; Scanner input = new Scanner (System.in); boolean validPW_Length = true, validPW_Symbols = true, validPW_enough_Digits = true; boolean validSSN_Digits = true, validSSN_Format = true, validSSN_Length = true; boolean validPhone_Symbols = true, validPhone_Format = true, validPhone_Length = true; public Prog1Methods_FA11() { } // you may insert a method here to display password status public void printPASSInfo(){ System.out.println("\t Password Information"); System.out.println("The Password:\t" + pw); System.out.println("Password Lrngth:\t" + validPW_Length); System.out.println("Password has minimum number of digits:\t" + validPW_enough_Digits); System.out.println("Password has correct symbols:\t" + validPW_Symbols); } // you may insert a method here to display the phone number status } </code></pre> <p>and here is where I am trying to call it:</p> <pre><code>case 2: System.out.println("Enter a password witha atleast 8 characters and atleast 2 numbers:\t"); pw = input.nextLine(); pm.readAndVerifyPASS(pw); pm.printPASSInfo(); break; </code></pre> <p>and the comile error:</p> <pre><code>MySkeletonProgram1_FA11.java:53: cannot find symbol symbol : method printPASSInfo() location: class Prog1Methods_FA11 pm.printPASSInfo(); ^ 1 error </code></pre> <p>Where I declare pm object:</p> <pre><code>public class MySkeletonProgram1_FA11{ public static void main(String[] args)throws Exception { // Declarations Scanner scan = new Scanner(System.in); Scanner input = new Scanner (System.in); Prog1Methods_FA11 pm = new Prog1Methods_FA11(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload