what is behavior in computer science.
Answers
Answer:
Objects have states and behaviors. Example: A dog has states - color, name, breed as well as behaviors – wagging the tail, barking, eating. An object is an instance of a class.
A class's behavior determines how an instance of that class operates; for example, how it will "react" if asked to do something by another class or object or if its internal state changes. Behavior is the only way objects can do anything to themselves or have anything done to them. For example, to go back to the theoretical Motorcycle class, here are some behaviors that the Motorcycle class might have:
Start the engine
Stop the engine
Speed up
Change gear
Stall
To define an object's behavior, you create methods, a set of Java statements that accomplish some task. Methods look and behave just like functions in other languages but are defined and accessible solely inside a class. Java does not have functions defined outside classes
Computer science is the study of Computer, computational machines and computation itself. as well as their theoretical and practical applications etc. Its help us in many things like- Presentation, Entertainment etc.