🔒 Closed Ano po yung oop sa java?

Status
Not open for further replies.
-Object-Oriented Programming Defined

Object-oriented programming is a method of programming based on a hierarchy of classes, and well-defined and cooperating objects.

import javax.swing.*;
import java.awt.Color;
import java.awt.event.*;

class ExampleProgram extends JFrame {

public ExampleProgram(){
String text = new String("I'm a simple Program ");
String text2 = text.concat(
"that uses classes and objects");

JLabel label = new JLabel(text2);
JPanel panel = new JPanel();
panel.setBackground(Color.white);

getContentPane().add(panel);
panel.add(label);
}

public static void main(String[] args){
ExampleProgram frame = new ExampleProgram();

frame.setTitle("Fruit $1.25 Each");
WindowListener l = new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
};

frame.addWindowListener(l);
frame.pack();
frame.setVisible(true);
}
}
 
-Object-Oriented Programming Defined

Object-oriented programming is a method of programming based on a hierarchy of classes, and well-defined and cooperating objects.

import javax.swing.*;
import java.awt.Color;
import java.awt.event.*;

class ExampleProgram extends JFrame {

public ExampleProgram(){
String text = new String("I'm a simple Program ");
String text2 = text.concat(
"that uses classes and objects");

JLabel label = new JLabel(text2);
JPanel panel = new JPanel();
panel.setBackground(Color.white);

getContentPane().add(panel);
panel.add(label);
}

public static void main(String[] args){
ExampleProgram frame = new ExampleProgram();

frame.setTitle("Fruit $1.25 Each");
WindowListener l = new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
};

frame.addWindowListener(l);
frame.pack();
frame.setVisible(true);
}
}
Salamat po ng marami
 
Status
Not open for further replies.

About this Thread

  • 3
    Replies
  • 1K
    Views
  • 2
    Participants
Last reply from:
GramSlayer

Trending Topics

Online now

Members online
1,027
Guests online
1,022
Total visitors
2,049

Forum statistics

Threads
2,274,739
Posts
28,957,893
Members
1,233,411
Latest member
marti
Back
Top