how to start your own java programs to start your own java programs cs106a, summer 2019 sarai gould...

57
How to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith Schwarz, Mehran Sahami, Eric Roberts, Stuart Reges, Chris Piech, Brahm Capoor, & others.

Upload: others

Post on 29-Mar-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

How to Start Your Own Java Programs

CS106A, Summer 2019Sarai Gould && Laura Cruz-Albrecht

Lecture 25

With inspiration from slides created by Keith Schwarz, Mehran Sahami, Eric Roberts, Stuart Reges, Chris Piech, Brahm Capoor, & others.

Page 2: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Announcements

● Download blank starter code from the website!

2

Page 3: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Learning Goals for Today

Learn About Writing Java code in the Real World!

3

Page 4: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Plan for Today

● Review: Server & Client● “Real” Java● Console Program● Basic Gui● Creating Our Own Project!● Example: Reading HTML with JSoup

4

Page 5: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

There are two types of internet programs: servers and clients.

5

Page 6: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Clients send requests to servers. Servers respond to those requests.

6

Page 7: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

7

Facebook Server

[email protected]

Send me the full name for [email protected]

“Laura Cruz-Albrecht”

Laura Cruz-Albrecht

Page 8: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

URL

In PollClient, change the HOST constant to:

http://cbc0026a.ngrok.io

8

Page 9: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Real Java?

9

Does this mean we didn’t learn REAL Java?

Page 10: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Of Course We Did!

While we did use some Stanford specific Java libraries at times, you did learn REAL Java!

All of the data structures, primitives, classes, loops, etc are all part of real programming and real Java!

10

Phew, that’s good.

Page 11: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

ACM Libraries

All quarter, we have used the Java ACM Libraries.

● Karel, ConsoleProgram, RandomGenerator…● GraphicsProgram, GOval, GRect, GImage...

11

I can’t...Can you imagine Java without me?!

Page 12: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

ACM Libraries

Today, we’ll look at how standard Java programs are written!

12

Can’t wait! 😊Sounds fun!

Page 13: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Hello World with ACMThis was the first ConsoleProgram we ever wrote! Notice:

● it imports acm.program.*● it extends a ConsoleProgram● It uses public void run() ● It uses println()

13

import acm.program.*;

public class HelloWorld extends ConsoleProgram {

public void run() {

println(“Hello, world!”);

}

}

Page 14: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Standard Hello WorldThis is Hello World in Standard Java! Notice:

● no imports or extends needed for this program! ● It uses public static void main(String[] args) ● It uses System.out.println()

14

public class HelloWorld{

public static void main(String[] args) {

System.out.println(“Hello, world!”);

}

}

Page 15: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

mainWhy public static void main(String[] args)?

main is the true entry point for a program in Java.

● It must be written exactly as seen above!● String[] args is an array of String arguments given to

the program.

15

Page 16: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

mainWhy public static void main(String[] args)?

main is the true entry point for a program in Java.

● It must be written exactly as seen above!● String[] args is an array of String arguments given to

the program.

System.out.println() is the true println()

Standard Java methods are static unless part of a class of objects.

16

Page 17: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Why did we use ConsoleProgram?Creates a new window.

Puts a new scrollable area in the window.

Provides print and println commands to send text output to the window.

Contains a main method that calls your run method.

17

Page 18: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Why did we use ConsoleProgram?

18

Page 19: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Standard Java Version

19

Page 20: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Reading Input with ACMThis is a short program that read in input! Notice:

● It uses readLine and readInt to read input

20

import acm.program.*;

public class SayingHello extends ConsoleProgram {

public void run() {

String name = readLine(“What’s your name?”);

int age = readInt(“How old are you?”);

println(“Hello” + name + “!”);

println(name + “ is “ + age + “ years old.”);

}

}

Page 21: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Reading Input with Standard JavaThis is another short program that read in input!

21

import java.util.Scanner;

public class SayingHello{

public static void main(String[] args) {

Scanner console = new Scanner(System.in);

System.out.println(“What’s your name?”);

String name = console.nextLine();

System.out.println(“What’s your name?”);

int age = console.nextInt();

System.out.println(“Hello” + name + “!”);

System.out.println(name + “ is “ + age + “ years old.”);

}

}

Page 22: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Reading Input with Standard JavaThis is another short program that read in input!

22

import java.util.Scanner;

public class SayingHello{

public static void main(String[] args) {

Scanner console = new Scanner(System.in);

System.out.println(“What’s your name?”);

String name = console.nextLine();

System.out.println(“What’s your name?”);

int age = console.nextInt();

System.out.println(“Hello” + name + “!”);

System.out.println(name + “ is “ + age + “ years old.”);

}

}

We have to create a Scanner to read input!

Page 23: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Reading Input with Standard JavaThis is another short program that read in input!

23

import java.util.Scanner;

public class SayingHello{

public static void main(String[] args) {

Scanner console = new Scanner(System.in);

System.out.println(“What’s your name?”);

String name = console.nextLine();

System.out.println(“What’s your name?”);

int age = console.nextInt();

System.out.println(“Hello” + name + “!”);

System.out.println(name + “ is “ + age + “ years old.”);

}

}

System.in is another name for the console here.

Page 24: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Reading Input with Standard JavaThis is another short program that read in input!

24

import java.util.Scanner;

public class SayingHello{

public static void main(String[] args) {

Scanner console = new Scanner(System.in);

System.out.println(“What’s your name?”);

String name = console.nextLine();

System.out.println(“What’s your name?”);

int age = console.nextInt();

System.out.println(“Hello” + name + “!”);

System.out.println(name + “ is “ + age + “ years old.”);

}

}

We have to print out the question using:System.out.println

Page 25: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Reading Input with Standard JavaThis is another short program that read in input!

25

import java.util.Scanner;

public class SayingHello{

public static void main(String[] args) {

Scanner console = new Scanner(System.in);

System.out.println(“What’s your name?”);

String name = console.nextLine();

System.out.println(“What’s your name?”);

int age = console.nextInt();

System.out.println(“Hello” + name + “!”);

System.out.println(name + “ is “ + age + “ years old.”);

}

}

We read in the input using:console.readLine()

Page 26: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Reading Input with Standard JavaThis is another short program that read in input!

26

import java.util.Scanner;

public class SayingHello{

public static void main(String[] args) {

Scanner console = new Scanner(System.in);

System.out.println(“What’s your name?”);

String name = console.nextLine();

System.out.println(“What’s your name?”);

int age = console.nextInt();

System.out.println(“Hello” + name + “!”);

System.out.println(name + “ is “ + age + “ years old.”);

}

}

Page 27: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

GraphicsPrograms?Creates a new window.

Creates a drawing canvas in the center of the window.

Provides convenient methods to detect Mouse Events.

Contains a main method that calls your run method.

27

Page 28: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Basic GUI with ACM

28

public class ColorFun extends Program {

public void init() {

JButton redButton = new JButton(“Red!”);

JButton blueButton = new JButton(“Blue!”);

add(redButton, SOUTH);

add(blueButton, SOUTH);

addActionListeners();

}

public void actionPerformed(ActionEvent e) {

if(e.getActionCommand().equals(“Blue!”){

setBackground(Color.BLUE);

} else {

setBackground(Color.RED);

}

}

}

Page 29: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Basic GUI with Standard Java

29

public class ColorFun implements ActionListener {

public static void main(String[] args) {

new ColorFun().init();

}

private JFrame frame;

public void init() {

frame = new JFrame(“ColorFun”);

frame.setSize(500, 300);

JButton redButton = new JButton(“Red!”);

JButton blueButton = new JButton(“Blue!”);

redButton.addActionListener(this);

blueButton.addActionListener(this);

frame.add(redButton, “South”);

frame.add(blueButton, “North”);

frame.setVisible(true);

}

public void actionPerformed(ActionEvent e) {

if(e.getActionCommand().equals(“Blue!”){

frame.setBackground(Color.BLUE);

} else {

frame.setBackground(Color.RED);

}

}

}

Page 30: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Basic GUI with Standard Java

30

public class ColorFun implements ActionListener {

public static void main(String[] args) {

new ColorFun().init();

}

private JFrame frame;

public void init() {

frame = new JFrame(“ColorFun”);

frame.setSize(500, 300);

JButton redButton = new JButton(“Red!”);

JButton blueButton = new JButton(“Blue!”);

redButton.addActionListener(this);

blueButton.addActionListener(this);

frame.add(redButton, “South”);

frame.add(blueButton, “North”);

frame.setVisible(true);

}

public void actionPerformed(ActionEvent e) {

if(e.getActionCommand().equals(“Blue!”){

frame.setBackground(Color.BLUE);

} else {

frame.setBackground(Color.RED);

}

}

}

Page 31: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Basic GUI with Standard Java

31

public class ColorFun implements ActionListener {

public static void main(String[] args) {

new ColorFun().init();

}

private JFrame frame;

public void init() {

frame = new JFrame(“ColorFun”);

frame.setSize(500, 300);

JButton redButton = new JButton(“Red!”);

JButton blueButton = new JButton(“Blue!”);

redButton.addActionListener(this);

blueButton.addActionListener(this);

frame.add(redButton, “South”);

frame.add(blueButton, “North”);

frame.setVisible(true);

}

public void actionPerformed(ActionEvent e) {

if(e.getActionCommand().equals(“Blue!”){

frame.setBackground(Color.BLUE);

} else {

frame.setBackground(Color.RED);

}

}

}

Page 32: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Basic GUI with Standard Java

32

public class ColorFun implements ActionListener {

public static void main(String[] args) {

new ColorFun().init();

}

private JFrame frame;

public void init() {

frame = new JFrame(“ColorFun”);

frame.setSize(500, 300);

JButton redButton = new JButton(“Red!”);

JButton blueButton = new JButton(“Blue!”);

redButton.addActionListener(this);

blueButton.addActionListener(this);

frame.add(redButton, “South”);

frame.add(blueButton, “North”);

frame.setVisible(true);

}

public void actionPerformed(ActionEvent e) {

if(e.getActionCommand().equals(“Blue!”){

frame.setBackground(Color.BLUE);

} else {

frame.setBackground(Color.RED);

}

}

}

Page 33: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Basic GUI with Standard Java

33

public class ColorFun implements ActionListener {

public static void main(String[] args) {

new ColorFun().init();

}

private JFrame frame;

public void init() {

frame = new JFrame(“ColorFun”);

frame.setSize(500, 300);

JButton redButton = new JButton(“Red!”);

JButton blueButton = new JButton(“Blue!”);

redButton.addActionListener(this);

blueButton.addActionListener(this);

frame.add(redButton, “South”);

frame.add(blueButton, “North”);

frame.setVisible(true);

}

public void actionPerformed(ActionEvent e) {

if(e.getActionCommand().equals(“Blue!”){

frame.setBackground(Color.BLUE);

} else {

frame.setBackground(Color.RED);

}

}

}

Page 34: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Basic GUI with Standard JavaWe had to create a frame.

Adding actionListeners was a lot more involved!

34

Page 35: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Why Not Libraries?

35

Why don’t we just use ACM all the time then?

Page 36: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Basic GUI with ACM● Benefits of libraries:

○ simplify syntax/rough edges of language/API ○ avoid re-writing the same code over and over ○ possible to make advanced programs quickly ○ leverage work of others

36

Yay! ❤

Page 37: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Basic GUI with ACM● Benefits of libraries:

○ simplify syntax/rough edges of language/API ○ avoid re-writing the same code over and over ○ possible to make advanced programs quickly ○ leverage work of others

● Drawbacks of libraries: ○ limitations on usage; e.g. ACM library cannot

be distributed for commercial purposes.

37

Oh. 😔

Page 38: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Creating Our Own Java ProjectWhat other sorts of cool Java libraries are out there?

How do we create our own Java projects using them?

38

Page 39: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Reading from the WebWe’re going to write a program that will grab HTML from a webpage from the internet and print out important information from that page!

Before we pick the webpage, let’s set up our new Java Project!

39

Page 40: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Let’s Create an Empty Project First!To create an empty project on your own, you don’t need the starter code!

You will need the starter code for some of the cool code we’ll use to read the HTML from our web page.

40

Page 41: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Let’s Create an Empty Project First!In your Eclipse menu, click on:

File -> New -> Java Project

41

Page 42: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Let’s Create an Empty Project First!Give your project a name:

Click Finish:

42

Page 43: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Let’s Create an Empty Project First!Eclipse will ask if you want to create a module.

Click Don’t Create:

43

Page 44: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Let’s Create a lib FolderIn your Eclipse menu, click on:

File -> New -> Folder

44

Page 45: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Let’s Create a lib FolderSelect your ReadingFromTheWeb project folder.

Create a lib folder to hold any .JAR files we may want!

Press Finish when done!

45

Page 46: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Let’s Get a .JARWe’re going to use the jsoup library to process HTML in a webpage. Let’s go get it!

If you search “jsoup” online, you should find it! Click on Download.

46

Page 47: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Let’s Get a .JARAfter you’ve clicked Download, you will see some links.

Click on jsoup-1.12.1.jar to download the .JAR file that contains jsoup!

47

Page 48: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Let’s Get a .JARLet’s put the .JAR file we just downloaded into our lib folder we just created!

We can drag it into our folder using Finder or Windows Explorer!

48

Step 1: Open your Folder Step 2: Open lib Step 3: Drag the .jar file into lib

Page 49: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Refresh Our ProjectNow, we can return to Eclipse and refresh our project!

Secondary click (two-finger or right click) on the project name and press Refresh.

49

There’s your .jar file!

Page 50: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Configuring Our Build PathEven though we’ve added our .jar to our folder, we need to add the .jar to our Build Path.

Let’s Configure Build Path...

50

Page 51: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Configuring Our Build PathClick:

● Libraries ● Classpath ● Add JARs...

51

Page 52: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Configuring Our Build PathSelect our jsoup jar and click OK. Then, you can press Apply and Close.

52

Page 53: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Creating Our Program ClassNow, we create our JSoupExample class so we can start coding!

We create this the same way we created a new project and a new folder!

53

Page 54: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Starter CodeWhile you could this program from Scratch there is a good starting point in the Starter Code.

You can code this portion in the Starter Code, or copy-paste JSoupExample from the Starter Code into your file!

54

Page 55: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Documentation/APIUsing the Documentation from the JSoup website, we can create a program that will:

● Get HTML from an explore courses page about CS classes● Print out all of the course titles for CS classes

Links to relevant documentation:

https://jsoup.org/cookbook/extracting-data/attributes-text-html

https://jsoup.org/cookbook/extracting-data/selector-syntax55

Page 56: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Let’s Code It!

56

Page 57: How to Start Your Own Java Programs to Start Your Own Java Programs CS106A, Summer 2019 Sarai Gould && Laura Cruz-Albrecht Lecture 25 With inspiration from slides created by Keith

Plan for Today

● Review: Server & Client● “Real” Java● Console Program● Basic Gui● Creating Our Own Project!● Example: Reading HTML with JSoup

Next Time: Life After 106A57