OS Discussion- Response 2

 Read below and respond with your own thought in 150 words.

—————————————————————————————————————————–

Object Oriented Programming (OOP) is  the programming idea that utilizes the concepts of objects, methods, and  classes. OOP is used to establish essentially what are commonly  referred to as classes, or in other words the “blueprints”. Classes are  used to develop objects and may cover an array of categories that are  broadly defined and share similar characteristics. 

An example of a class could be written as such:

public class Student{

String firstName;

String lastName;

int age;

}

This class represents the attributes that would make up the information of a student. 

Objects are created from classes and are individual segments that are comprised of the classes listed attributes. 

An example of an object, using the information from the previous example could be shown as:

public class Student{

String firstName;

String lastName;

int age;

}

public static void main(String[] args) {

Student myClassmate = new Student();

myClassmate.firstName = “John”;

myClassmate.lastName = “Smith”;

myClassmate.age = 23;

System.out.println(myclassmate.firstName);

Here we have an object that is comprised of the attributes defined by the class “Student”

A method is a block of code that can be used to perform a task or function. 

An example could be written as such:

public static void main(String[] args) {

method();

}

public static void method() {

System.out.println(“Hello World”);

}

When  executed, the system recognizes the method that states that it should  print out the words “Hello World”. By using the method(); it will  execute everything that was defined by that method.