ITEC30 (Sir Jonel) Flashcards
Allows Java Application to display information in the command prompt / MS-DOS Prompt
Standard Output Object
Standard Output Object
2 TYPES
System.out.print()
System.out.println()
does not position the cursor to beginning of the next line after printing
System.out.print()
position the cursor to the beginning of the next line after printing
System.out.println()
Class that allows to easily display dialog box containing information
JOptionPane.showMessageDialog()
to refer to the standard output device
System.out
to refer to the standard input device.
System.in
is not directly supported in Java
Console input
to create an object to read input from System.in
Scanner class
creates an object of the Scanner type.
Scanner(System.in)
declares that input is a variable whose type is Scanner.
Scanner sc
creates a Scanner object and assigns its reference to the variable input.
Scanner sc = new Scanner(System.in)
This class is used to display simple dialog boxes to get the text input from the user.
method always returns the user’s input as a String.
JOptionPane.showInputDialog()
is a static method of JOptionPane class. This method uses single parameter that specifies the prompting message that is displayed in the dialog box.
showInputDialog
refers to a style of programming
Programming Paradigm
2 Types of Programming Paradigm
Imperative Paradigm
Declarative Paradigm
Allows splitting those instructions into procedures
Procedural programming (Imperative)
is the most popular programming paradigm
OOP (Object Oriented Programming Paradigm)
Key Characteristics of Object Oriented Programming
Class, Abstraction, Encapsulation, Inheritance, Polymorphism
is a computer programming that organizes software design around data, or objects, rather than functions and logic
OOP (Object Oriented Programming)
is a programming paradigm that relies on the concept of classes and objects
OOP (Object Oriented Programming)
are user defined data types that act as the blueprint for individual objects, attributes and methods
Classes
are instances of a class created with specifically deifened data
Objects
are functions that are defined inside a class that describe the behaviors of an object
Methods
are defined in the class template and represent the state of an object
Attributes
4 Object Oriented Programming Principle
- Abstraction
- Encapsulation
- Inheritance
- Polymorphism
Objects only reveal internal mechanisms that are relevant for the use of other objects, hiding any unnecessary implementation class
Attribute
This principle states that all important information is contained inside an object and only select information is expposed
Encapsulation
Classes can reuse code from other. Relationships and subclasses between objects can be assigned, enabling developers to reuse common logic while still maintaining a unique hierarchy
Inheritance
is the ability for different objects to respond differently to the same message.
Polymorphism
Popular pure OOP Language
Ruby, Scala, Jade and Emerald
is credited as being the first object oriented programming language
Simula
Programming languages designed primarily for OOP
Java, Python, C++
Other Programming languages that pair with OOP
Visual Basic, ,NET PHP, JavaScript
Benefits of Object Oriented Programming
- Modularity
- Reusability
- Productivity
- Easily upgradable and scalable
- Interface descripition
- Security
- Flexibilty