Introduction to 61B, Java
1
Lecture 1
CS61B, Fall 2026 @ UC Berkeley
Lecturers: Manuel Sabin, Josh Hug
Course website: https://fa26.datastructur.es
Welcome to 61B
Lecture 1, CS61B, Fall 2026
2
Layers of Abstraction
In 61A, you learned that programming is done in layers of abstraction.
x = [3, 4, 5]
x.append(6)
Layers of Abstraction
In 61A, you learned that programming is done in layers of abstraction.
x = [3, 4, 5]
x.append(6)
Us, in 61B
61B and Lists
Over the first five weeks of 61B, we’ll explore two radically different choices for how one can implement a list.
x = [3, 4, 5]
x.append(6)
Us, in 61B
61B Overview
What is 61B about?
Assumes solid foundation in programming fundamentals, including:
Will not cover AI workflows.
Java
In our course, we’ll use the Java programming language.
Python, Scheme, SQL
61A
61B
61C
Java
C, Assembly
Other Reasons to Take 61B
Other great features of 61B:
About Us (Josh)
Josh Hug: Berkeley faculty since 2014.
9
About Us (Manuel)
Manuel Sabin: 2nd year as Berkeley faculty
Question for You
What do you hope / expect to learn from this class? Why are you taking it?
Who are you?
61B Logistics
Lecture 1, CS61B, Fall 2026
12
Joining the Course
Course staff does not control getting into the course.
Being added to course platforms (Ed, Gradescope) is manual. We do this every day. Please do not email us (cs61b@berkeley.edu) asking to be added to the platforms unless it’s been more than 2 days since you joined the course.
If you are a pending concurrent enrollment student, you should be added to bCourses, Ed, and Gradescope 1–2 days after you've submitted your application.
DSP (Disabled Students' Program)
If you have DSP accommodations, please submit your letter through the DSP portal as soon as possible!
Course Components
Lectures (~40/hours) provide you with an introduction and a foundation.
You’ll learn most of what you learn in the class with practice (~160-200 hours):
Before
After
Class Phase
This class is divided into three phases:
Class Phase
This class is divided into three phases:
Evaluation
Four types of points in this class:
Full details around point distributions, letter grade assignments, grade replacement, etc. are on the website.
Lateness Policies
Homeworks, mini-projects, and design projects turned in late will have 5% deducted per 12 hours (with a small secret grace period).
No extensions for anyone on weekly surveys (we effectively drop the lowest 4).
Exams
There will be three exams, all on paper:
More about exams later.
Labs and Discussion Sections
There are two types of meetings other than lecture:
To attend discussion or lab, fill out the Discussion / Lab matching form: https://forms.gle/fc55vdZSYqLrDKJT9
Exception: Just this week, lab is drop-in.
Bridge Section (for Those with Shakier Foundations)
If you had B or lower in your prerequisite class (CS61A, CS88), if you took E7, or if you find this week’s lab problem below challenging:
Then I strongly recommend attending the Bridge Section(s):
And also make sure you get started on HW 1 today and HW2 by Friday.
Point Breakdown and Attendance Policy
| Points |
Surveys | 120 |
Homeworks | 280 |
Mini-Projects | 600 |
Design Projects + Attendance | 1900 |
Mini-Midterm 1 | 450 |
Midterm 2 | 1100 |
Final Exam | 1700 |
Total | 6150 |
If you opt in to discussion + lab track:
If you opt in to only one track:
If you opt out of discussion and lab
Attending lecture:
tl;dr; Get points for being at things, but if you opt-out and do well, no net penalty.
LLMs / Plagiarism Policy
Lecture 1, CS61B, Fall 2026
24
A Chat with a Large Language Model
A Chat with a Large Language Model [1 minute and 15 seconds later]
Why Learn Programming at All?
Given that industry programmers mostly do not write code anymore, you may ask: Why are we bothering to learn to write code?
We’ll discuss this together in more detail in a future lecture!
Surprising Fall 2025 Observations
On midterm 1 (programming): 10% of students earned less than 10% on midterm 1.
Surprising Fall 2025 Observations
Estimate: 30 to 50% of students turned in LLM code on Project 4 (a design project).
Spring 2026 went better because we had students do a programming-on-a-computer exam.
LLM Recommendations
We recommend using LLMs minimally when doing work for the class. Guidelines:
It is reasonable to use LLMs as a tutor.
LLM Usage by Staff
All assignments, worksheets, readings, and exam problems are designed by human staff (mostly Josh).
Josh’s personal strong belief: AI art and AI writing is bad and alienating.
Hello World
Lecture 1, CS61B, Fall 2026
32
Intro to Java
Let’s try writing some simple Java programs.
If you’ve never written in code in Python or Java, this will be a little harder for you, but still comprehensible.
This section might be a bit boring if you have Java experience.
(See video or code linked on course website)
Lecture code repository: https://github.com/Berkeley-CS61B/lectureCode-fa26
Coding Demo: Hello World
hello.py
void main() {
}
HelloWorld.java
Coding Demo: Hello World
print("hello world")
hello.py
void main() {
IO.println("hello world");
}
HelloWorld.java
Java and Object Orientation
Reflections on Hello World:
Hello Numbers
Lecture 1, CS61B, Fall 2026
37
Coding Demo: Hello Numbers
x = 0;
while x < 10:
print(x)
x = x + 1
hellonumbers.py
void main() {
x = 0;
while (x < 10) {
IO.println(x);
x = x + 1;
}
}
HelloNumbers.java
Coding Demo: Hello Numbers
x = 0;
while x < 10:
print(x)
x = x + 1
hellonumbers.py
void main() {
int x;
x = 0;
while (x < 10) {
IO.println(x);
x = x + 1;
}
}
HelloNumbers.java
Coding Demo: Hello Numbers
x = 0;
while x < 10:
print(x)
x = x + 1
hellonumbers.py
void main() {
int x = 0;
while (x < 10) {
IO.println(x);
x = x + 1;
}
}
HelloNumbers.java
Coding Demo: Hello Numbers
x = 0;
while x < 10:
print(x)
x = x + 1
x = "horse" # works
print(x)
hellonumbers.py
void main() {
int x = 0;
while (x < 10) {
IO.println(x);
x = x + 1;
}
x = "horse"; // doesn't work
String x = "horse"; // doesn't work
}
HelloNumbers.java
Coding Demo: Hello Numbers
x = 0;
while x < 10:
print(x)
x = x + 1
# crashes here
print(5 + "horse")
hellonumbers.py
void main() {
int x = 0;
while (x < 10) {
IO.println(x);
x = x + 1;
}
x = "horse"; // program doesn't run
}
HelloNumbers.java
Java and Static Typing
Reflections on Hello Numbers:
Java is statically typed!
Larger
Lecture 1, CS61B, Fall 2026
44
Coding Demo: Larger
def larger(x, y):
if (x > y):
return x
return y
larger.py
int larger(x, y) {
if (x > y) {
return x;
}
return y;
}
LargerDemo.java
Coding Demo: Larger
def larger(x, y):
if (x > y):
return x
return y
larger.py
int larger(int x, int y) {
if (x > y) {
return x;
}
return y;
}
LargerDemo.java
Coding Demo: Larger
def larger(x, y):
if (x > y):
return x
return y
print(larger(-5, 10))
larger.py
int larger(int x, int y) {
if (x > y) {
return x;
}
return y;
}
void main() {
IO.println(larger(-5, 10));
}
LargerDemo.java
Larger: Reflections
Reflections on Static Typing
Lecture 1, CS61B, Fall 2026
49
Reflections on Static Typing
Static typing is that thing in Java where everything has a declared type, and that type never changes (i.e. it is static).
The Good:
The Bad:
Reflections on Static Typing (My Answers)
The Good:
�The Bad:
Compilation (extra)
Lecture 1, CS61B, Fall 2026
52
Fall 2026 note: We skipped these slides. We’ll return to them in a much later lecture.
Compilation vs. Interpretation
In Java, compilation and interpretation are two separate steps.
Hello.java
Hello.class
javac
java
stuff
happens
Compiler
Interpreter
Why make a class file at all?
Note: .class files are easily reversible into similar looking Java files.
You can learn more about all this in 61C and particularly 164.
Demo: Compilation in Terminal
jug ~/.../intro1
$ ls
HelloWorld.java
$ javac HelloWorld.java
$ ls
HelloWorld.class HelloWorld.java
$ java HelloWorld
Hello World!
Note: This is a very old school (but sometimes useful) way of interacting with Java code. We won’t do this in 61B.
IntelliJ
Lecture 1, CS61B, Fall 2026
56
Example Workflows
There are many different workflows for writing programs.
Let’s see what our programs look like in the IDE for our course.
IntelliJ Screenshot
Example feature: IntelliJ automatically and continuously detects syntax errors.
Admonition
Our expectation is that everyone in this class is using IntelliJ.
HW1: Due Friday!
Lecture 1, CS61B, Fall 2026
60
Time to Go Learn Java Basics!
I am not going to spend time in this class covering for loops, while loops, etc. in Java.
Lab 1 is out.
HW1 is out, due Friday at 11:59 PM!