Презентация Class and Object. Java Core онлайн

На нашем сайте вы можете скачать и просмотреть онлайн доклад-презентацию на тему Class and Object. Java Core абсолютно бесплатно. Урок-презентация на эту тему содержит всего 28 слайдов. Все материалы созданы в программе PowerPoint и имеют формат ppt или же pptx. Материалы и темы для презентаций взяты из открытых источников и загружены их авторами, за качество и достоверность информации в них администрация сайта не отвечает, все права принадлежат их создателям. Если вы нашли то, что искали, отблагодарите авторов - поделитесь ссылкой в социальных сетях, а наш сайт добавьте в закладки.



Оцените!
Оцените презентацию от 1 до 5 баллов!
  • Тип файла:
    ppt / pptx (powerpoint)
  • Всего слайдов:
    28 слайдов
  • Для класса:
    1,2,3,4,5,6,7,8,9,10,11
  • Размер файла:
    852.50 kB
  • Просмотров:
    68
  • Скачиваний:
    0
  • Автор:
    неизвестен



Слайды и текст к этой презентации:

№1 слайд
Class and Object Java Core
Содержание слайда: Class and Object Java Core

№2 слайд
Agenda Class and Object
Содержание слайда: Agenda Class and Object Access to data Fields of class Getters and Setters Constructors Methods of class Creating objects Examples

№3 слайд
Class and Object A class is a
Содержание слайда: Class and Object A class is a prototype (template) from which objects are created An object is a software bundle of related state and behavior

№4 слайд
Class lt access specifier gt
Содержание слайда: Class <access specifier> class ClassName { // fields <access specifier> <data type> variable1; ... <access specifier> <data type> variableN; // constructors <access specifier> ClassName(parameter_list1){ // method body } ... <access specifier> ClassName(parameter_listN){ // method body } // methods <access specifier> <return type> method1(parameter_list){ // method body } ... <access specifier> <return type> methodN(parameter_list){ // method body }

№5 слайд
Class
Содержание слайда: Class

№6 слайд
Access to data public class
Содержание слайда: Access to data public class Student {...} private int age; public void print(){} Controlling Access to Members of a Class Class Package Subclass World private Y — — — (not) Y Y — — protected Y Y Y — public Y Y Y Y

№7 слайд
Special Requirements to
Содержание слайда: Special Requirements to source files a source code file (.java) can have only one public class name of this class should be exactly the same of file name before extension (including casing) source code file can have any number of non-public classes most code conventions require use only one top-level class per file

№8 слайд
Default values for fields
Содержание слайда: Default values for fields

№9 слайд
Type casting Widening
Содержание слайда: Type casting Widening (implicit or automatic) type casting take place when, the two types are compatible the target type is larger than the source type

№10 слайд
Methods and overloading
Содержание слайда: Methods and overloading Methods are functions that are executed in context of object Always have full access to data of object Object can have multiple methods with same name but different signature (type and order of parameters) Signature doesn't include return type, methods can't be overloaded by return types

№11 слайд
Variable length arguments
Содержание слайда: Variable length arguments Methods in Java support arguments of variable length Should be last argument in method definition

№12 слайд
Access to fields The
Содержание слайда: Access to fields The following class uses public access control: public class Student { public String name; public int age; ... } Student stud = new Student(); stud.name = “Krystyna”; stud.age = 22;

№13 слайд
Getters and Setters The
Содержание слайда: Getters and Setters The following class uses private access control: public class Student { private String name; public String getName() { return this.name; } public void setName(String name) { this.name = name; } }

№14 слайд
Getters and Setters Student
Содержание слайда: Getters and Setters Student student = new Student(); student.setName(“Franko”); String nameStud = student.getName();

№15 слайд
Getters and Setters can be
Содержание слайда: Getters and Setters can be Complex public class Sum { private int a, b, c; void setA(int m) { this.a = m; c = a + b; } void setB(int n) { this.b = n; c = a + b; } int getA() { return this.a; } int getB() { return this.b; } int getC() { return this.c; } public void sum(int m, int n) { this.a = m; this.b = n; this.c = m + n; } }

№16 слайд
Keyword quot this quot this
Содержание слайда: Keyword "this" this always points to current object can't lose context like JavaScript not required in most cases often needed to distinguish between parameters and fields:

№17 слайд
Keyword static Keyword static
Содержание слайда: Keyword 'static' Keyword 'static' indicates that some class member (method or field) is not associated with any particular object Static members should be accessible by class name (good practice, not required by language itself)

№18 слайд
Keyword static
Содержание слайда: Keyword 'static'

№19 слайд
Constructors Constructors
Содержание слайда: Constructors Constructors – special kind of methods called when instance created Name should be same as a class Class may have multiple overloaded constructors If not provided any constructor, Java provides default parameterless empty constructor

№20 слайд
Constructors
Содержание слайда: Constructors

№21 слайд
Creating objects new Student
Содержание слайда: Creating objects – new() Student stud1 = new Student(); stud1.setName(“Dmytro”); stud1.setAge(25); Student stud2 = new Student(“Olga”); stud2.setAge(24); Student stud3 = new Student(“Ivan”, 26); int n = Student.count;

№22 слайд
Private constructor Making
Содержание слайда: Private constructor Making constructor private will prevent creating instances of a class from other classes Still allows creating instances inside static methods of the class

№23 слайд
toString System.out.println
Содержание слайда: toString() System.out.println(student); com.edu.Student@659e0bfd @Override public String toString() { return "Student [lastNname=" + lastNname + ", firstName=" + firstName + ", age=" + age + "]"; } Student [lastNname=Ivanov, firstName=Vasiy, age=22]

№24 слайд
Example Create Console
Содержание слайда: Example Create Console Application project in Java. Add class Student to the project. Class Student should consists of two private fields: name and rating; properties for access to these fields static field avgRating – average rating of all students default constructor and constructor with parameters methods: betterStudent - to definite the better student (between two, return true or false) toString - to output information about student changeRating - to change the rating of student In the method main() create 3 objects of Student type and input information about them. Display the average and total rating of all student.

№25 слайд
Practical task Create Console
Содержание слайда: Practical task Create Console Application project in Java. Add class Employee to the project. Class Employee should consists of three private fields: name, rate and hours; static field totalSum properties for access to these fields; default constructor, constructor with 2 parameters (name and rate) and constructor with 3 parameters; methods: salary - to calculate the salary of person (rate * hours) toString - to output information about employee changeRate - to change the rate of employee bonuses – to calculate 10% from salary In the method main() create 3 objects of Employee type. Input information about them. Display the total hours of all workers to screen

№26 слайд
Homework Create Console
Содержание слайда: Homework Create Console Application project in Java. Add class Person to the project. Class Person should consists of two private fields: name and birthYear (the birthday year) properties for access to these fields default constructor and constructor with 2 parameters methods: age - to calculate the age of person input - to input information about person output - to output information about person changeName - to change the name of person In the method main() create 5 objects of Person type and input information about them.

№27 слайд
UDEMY course quot Java
Содержание слайда: UDEMY course "Java Tutorial for Complete Beginners": https://www.udemy.com/java-tutorial/ UDEMY course "Java Tutorial for Complete Beginners": https://www.udemy.com/java-tutorial/ Complete lessons 17-23:

№28 слайд
The end
Содержание слайда: The end

Скачать все slide презентации Class and Object. Java Core одним архивом: