For the past two years, I’ve been writing a blog post each month featuring common mistakes that students make, tools to make students’ lives easier, sample problems, and discussions of common course topics. While I’ll be signing off from these monthly blog posts, I’d like to take the time to feature my top picks from the last couple of years: using git, topics in Java programming, and avoiding begging the question in proofs.
Tag: java
Practice Problem: Ending with a Newline
Let’s consider a text file: maybe it ends with a newline character, or maybe it doesn’t. Tools like git work more smoothly with files that end in newlines. Command-line tools like cat also produce clearer output when working with files that end in a newline. So, today’s Java programming problem asks you to fix files that don’t end in a newline.
What’s That Tiny Makefile?
When I’m working with programming students, I usually write a quick Makefile. Only a few lines long, this file allows us to recompile code on the command line just by typing “make”. In this post, we’ll skip over all the details of writing complex Makefiles. Instead, we’ll see how to slap together a rudimentary Makefile in seconds — one that will save us time while we’re working on an assignment.
Better println() Debugging in Java
In today’s blog post, we’ll look at one way to improve System.out.println() debugging in Java. Namely, let’s make it so our println() debugging outputs include the name of the source code file, the method name, and the line number where the output happens. Debugging with println() is fast and easy, and it’s not going anywhere; so, let’s just make its output more useful.
The Big Three in Java, Part Four: equals(Object) in Hierarchies
In the final entry in a series of four blog posts about the “big three” methods in Java, we return to the Object.equals(Object) method. Specifically, we discuss how to maintain the symmetry and transitivity properties of the method in class hierarchies. We answer the question: when do we use instanceof, and when do we check for class equality instead?
