SlideShare a Scribd company logo
1 of 3
Download to read offline
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);
    }


}

More Related Content

Similar to Class 3 2ciclo

CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical Groovy
Codecamp Romania
 
public class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdfpublic class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdf
arjuncp10
 
Hello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdfHello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdf
irshadkumar3
 
About java
About javaAbout java
About java
Jay Xu
 
Step 1 The Pair Class Many times in writing software we come across p.pdf
Step 1 The Pair Class Many times in writing software we come across p.pdfStep 1 The Pair Class Many times in writing software we come across p.pdf
Step 1 The Pair Class Many times in writing software we come across p.pdf
formaxekochi
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#
Doncho Minkov
 
Scala - fra newbie til ninja på en time
Scala - fra newbie til ninja på en timeScala - fra newbie til ninja på en time
Scala - fra newbie til ninja på en time
karianneberg
 

Similar to Class 3 2ciclo (20)

CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical Groovy
 
Explain Classes and methods in java (ch04).ppt
Explain Classes and methods in java (ch04).pptExplain Classes and methods in java (ch04).ppt
Explain Classes and methods in java (ch04).ppt
 
public class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdfpublic class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdf
 
Java essence part 1
Java essence part 1Java essence part 1
Java essence part 1
 
Polymorphism.pptx
Polymorphism.pptxPolymorphism.pptx
Polymorphism.pptx
 
Generics
GenericsGenerics
Generics
 
Hello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdfHello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdf
 
OOP Lab Report.docx
OOP Lab Report.docxOOP Lab Report.docx
OOP Lab Report.docx
 
3 j unit
3 j unit3 j unit
3 j unit
 
About java
About javaAbout java
About java
 
Java Class Design
Java Class DesignJava Class Design
Java Class Design
 
Assignment 7
Assignment 7Assignment 7
Assignment 7
 
encapsulation, inheritance, overriding, overloading
encapsulation, inheritance, overriding, overloadingencapsulation, inheritance, overriding, overloading
encapsulation, inheritance, overriding, overloading
 
Step 1 The Pair Class Many times in writing software we come across p.pdf
Step 1 The Pair Class Many times in writing software we come across p.pdfStep 1 The Pair Class Many times in writing software we come across p.pdf
Step 1 The Pair Class Many times in writing software we come across p.pdf
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#
 
Object oriented concepts
Object oriented conceptsObject oriented concepts
Object oriented concepts
 
Simple class and object examples in java
Simple class and object examples in javaSimple class and object examples in java
Simple class and object examples in java
 
Corejava Training in Bangalore Tutorial
Corejava Training in Bangalore TutorialCorejava Training in Bangalore Tutorial
Corejava Training in Bangalore Tutorial
 
Scala - fra newbie til ninja på en time
Scala - fra newbie til ninja på en timeScala - fra newbie til ninja på en time
Scala - fra newbie til ninja på en time
 
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
 

More from Miguel Mastarreno Macías (20)

Mata
MataMata
Mata
 
Gisella bravo portafolio
Gisella bravo portafolioGisella bravo portafolio
Gisella bravo portafolio
 
Portafolio kenia original 2 a
Portafolio kenia original 2 aPortafolio kenia original 2 a
Portafolio kenia original 2 a
 
Class 1 y 2 2ciclo
Class 1 y 2 2cicloClass 1 y 2 2ciclo
Class 1 y 2 2ciclo
 
Proyecto
ProyectoProyecto
Proyecto
 
Proyecto de ingles traducido
Proyecto de ingles traducidoProyecto de ingles traducido
Proyecto de ingles traducido
 
Class 6
Class 6Class 6
Class 6
 
Class 5
Class 5Class 5
Class 5
 
Class 4
Class 4Class 4
Class 4
 
Class 3
Class 3Class 3
Class 3
 
Class 1
Class 1Class 1
Class 1
 
Kenii
KeniiKenii
Kenii
 
Gissy
GissyGissy
Gissy
 
Aby
AbyAby
Aby
 
Folder
FolderFolder
Folder
 
Gestor proyectocalculo
Gestor proyectocalculoGestor proyectocalculo
Gestor proyectocalculo
 
Diapositivas avance calculo
Diapositivas avance calculoDiapositivas avance calculo
Diapositivas avance calculo
 
Proyecto kenia gisse miguel aby
Proyecto kenia gisse miguel abyProyecto kenia gisse miguel aby
Proyecto kenia gisse miguel aby
 
Calculo mastarreno
Calculo mastarrenoCalculo mastarreno
Calculo mastarreno
 
Calculo folder gisy.editado
Calculo folder gisy.editadoCalculo folder gisy.editado
Calculo folder gisy.editado
 

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, 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; }
  • 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); } }