Class 3
       Exposure: Methods and Attributes Group #3
       Exposure: Group #4
       Instance Variables
       Class Variables
       Local variables




                            Methods and Attributes
METHODS.- The method has a pair of keys , among which is the code that will be executed
when the function call .

ATTRIBUTES.- Determine a storage structure for each class object

EJERCICIO.-
public class person {
private String name;

public void setearName (String value)
{
      name=value;
}
public void getName()
{
      System.out.println(name);

}
}
Instance Variables, Class Variables and Local variables

    Local variables.- those are that can be used anywhere in the program.
    Class Variables.- is typical of the class that contains.
    Instance Variables.- are used to define the attributes of an object.



public class student {
      private String name;
      private String surnameFather;
      private String surnameMother;
      private int age;
      public String specialty;

      int totaltelephone=0;
      String [] numbertelephono;
       public int averagePrevious;
       public int course;
       public void setData1 (String espec,int      proant,int course)
       {

              this.course=course;
                           if(curso>=4)
                           {
                                  specialty =spec;
                                  averagePrevious =aver;
                           }
                           else{
                                  averagePrevious =aver;
                           }
        }
      public void setdataFamily(String name,String surnameFather,String
surnameMother,int age)
      {
             this.name=name;
             this.surnamFather=surnameFather;
             this.surnameMother=surnameMother;
             this.age=age;
      }

      public void setTelephone(String Number)
      {
            totaltelephone++;
            numberTelephone=new String[numberTelephone];
            numberTelephone [numberTelephone -1]=Number;

      }
public void Data()
    {
           System.out.println(course);
         System.out.println(averagePrevious);
         System.out.println(specialty);
           System.out.println(name);
           System.out.println(surnameFather);
           System.out.println(surnameMother);
           System.out.println(age);
    }


}

Class 3 2ciclo

  • 1.
    Class 3  Exposure: Methods and Attributes Group #3  Exposure: Group #4  Instance Variables  Class Variables  Local variables Methods and Attributes METHODS.- The method has a pair of keys , among which is the code that will be executed when the function call . ATTRIBUTES.- Determine a storage structure for each class object EJERCICIO.- public class person { private String name; public void setearName (String value) { name=value; } public void getName() { System.out.println(name); } }
  • 2.
    Instance Variables, ClassVariables and Local variables  Local variables.- those are that can be used anywhere in the program.  Class Variables.- is typical of the class that contains.  Instance Variables.- are used to define the attributes of an object. public class student { private String name; private String surnameFather; private String surnameMother; private int age; public String specialty; int totaltelephone=0; String [] numbertelephono; public int averagePrevious; public int course; public void setData1 (String espec,int proant,int course) { this.course=course; if(curso>=4) { specialty =spec; averagePrevious =aver; } else{ averagePrevious =aver; } } public void setdataFamily(String name,String surnameFather,String surnameMother,int age) { this.name=name; this.surnamFather=surnameFather; this.surnameMother=surnameMother; this.age=age; } public void setTelephone(String Number) { totaltelephone++; numberTelephone=new String[numberTelephone]; numberTelephone [numberTelephone -1]=Number; }
  • 3.
    public void Data() { System.out.println(course); System.out.println(averagePrevious); System.out.println(specialty); System.out.println(name); System.out.println(surnameFather); System.out.println(surnameMother); System.out.println(age); } }