Skip to main content

Questions tagged [java]

Questions about instruction specific to the programming language Java. Use this tag only when the language used would affect the question significantly (if your question uses Java as an example, but does not focus on the language itself, you need not use the tag).

Filter by
Sorted by
Tagged with
3 votes
1 answer
410 views

Curriculum choice for AP Computer Science A

We are currently researching what curriculum to use/adapt for the 2019-2020 school year. It will be our first year offering AP CSA. The students taking the class will have had 3-7 years of computers ...
5 votes
2 answers
226 views

Are jUnit or TestNG simple enough for undergraduates to apply in a matter of weeks? What alternative?

I was hoping that in this year's Software Engineering class, our capstone for Computer Science, could implement a disciplined automated test strategy for their Java project. Now, with only seven weeks ...
7 votes
16 answers
2k views

Parent class variable pointing to Child class

Given the following: Dog rover = new Puppy("rover"); // Where Puppy extends Dog A student asked why would you ever want or need a Dog variable point to ...
17 votes
11 answers
3k views

Explaining access levels and visibility in OOP

While teaching OOP in a high school CS major (in java), it is important (and part of the curriculum in any case) to explain "what is the meaning of this public ...
2 votes
5 answers
120 views

When teaching Java, should I teach try-catch from the outset?

TL;DR How important is the try ... catch syntax when starting out with learning Java? Background: I'm teaching A level CS in the UK (age 16-18) and we're using Java ...
1 vote
1 answer
55 views

Is there an array-like data type in Java that can cope with generic types better than the built-in array?

TL;DR I'm looking for a replacement for the primitive array data type in Java that works better with generic data types. Background: I'm teaching A level CS in the UK (age 16-18) and we're using Java ...
0 votes
3 answers
283 views

Best books for solid foundation build up for python and java

Fellow programmers. I am currently learning java and python in my Master's degree (introduction) and I did those languages 2 years ago. And when I revisited for the units I feel like I have basic ...
10 votes
10 answers
6k views

Explaining how an Interface is a contract

When teaching Interfaces (in Java, for example), it is common to describe them as a contract. Which means that if a class implements an interface, it has to use the methods in the interface. As an ...
5 votes
12 answers
1k views

Teaching the tradeoffs of the foreach loop

Edit: It's been quite a while since I posted this question, and in the intervening time, I have come to love the foreach loop. However, in order to avoid invalidating answers, I leave the text ...
3 votes
3 answers
454 views

What's a good example of a static factory method returning instances of subclasses?

One benefit of having a class provide a static factory method rather than public constructors is the method can return an instance of a subclass. For example, if the class ...
1 vote
2 answers
111 views

Getting started on contributing to open source and making software

I’m just graduated high school. I learnt java in high school, but the java I learnt was taught on bluej and we weren’t taught to create any software or anything. I want to start contributing to open ...
5 votes
3 answers
284 views

Best book and video lecture series to follow for an "object oriented programming" course for advanced undergraduates

I am looking for an elegant textbook to be followed for self-study in an objected oriented programming course at the undergraduate level. Our course is as shown: I humbly request you to suggest to me ...
2 votes
2 answers
235 views

How to learn Java as a beginner?

I want to start learning Java from scratch. But as a beginner, I don't know where to start or what to learn first. I have basic knowledge in C++ but Java is an entirely new area to me. Can anyone give ...
1 vote
1 answer
206 views

AP Computer Science A vs. OCP

Out of my own interest, I have been self-learning Java over the past few months. I decided I should take this to a greater advantage, so I have been considering taking the OCP (Oracle Certified ...
9 votes
7 answers
882 views

My teacher said that java is pass-by-reference when the type is not a primitive

I am an undergrad student. I am an experienced programmer. For reasons out of the scope of this question, I ended up in a class where basic things about C++ and Java are being taught (but I already ...
0 votes
1 answer
125 views

Cheating detection script [duplicate]

The pandemics has incredibly increased the number of cheating cases. Do you know of any script (bash or other scripting language) for checking a bunch of Java code submissions for similarity? I know I ...
26 votes
11 answers
4k views

When mentoring individuals, teach clean coding and simple/effective thinking or let them do it their way?

I have a background of 20+ years professional coding, but my heart is really in teaching. About three years ago, I started tutoring ages grade 6 through adult in coding topics. introduction to coding ...
2 votes
3 answers
408 views

Is there a Java library for testing command line applications?

JUnit seems to work well for unit tests, but I'm not interested in unit tests, I want to test and entire command line application as a black box. I have created a text-based adventure game project for ...
3 votes
4 answers
1k views

Java: The Complete Reference, which edition to follow

Java is updating on a regular basis and it being so the corresponding text books to study Java also changes. Now I do not know why the edition "Java 2: The Complete Reference" by Herbert ...
1 vote
1 answer
138 views

JavaFX and console-based interfaces, at the CS1 level

I'm running into some annoying technical problems in trying to incorporate JavaFX into my CS1 class, mainly arising from the constraints of avoiding/minimizing material they haven't yet learned. ...
3 votes
7 answers
317 views

methods early in Java - before objects

Does it make sense to introduce methods even before objects? What we are attempting to do is to get students out of the "everything in main()" mode as soon as possible. Suppose one starts out with a ...
8 votes
4 answers
1k views

First project in my second year data structures intro

I am currently teaching the pretty much normal second year Data Structures and Algorithms course. In this course there are four programming projects, with the first project completed the automated ...
26 votes
8 answers
5k views

What autograding software do folks use for Java code?

Grading currently either takes me a huge amount of time, or gets done in an extremely cursory way. It occurs to me that, if my students were able to submit code into some sort of autotester, they ...
0 votes
0 answers
55 views

Spring core exercices

I'm actually studying (free studying using online books) to pass the Pivotal Spring core certification and i need some exercices (online or pdf) to practice in order to master the framework as well, ...
7 votes
4 answers
221 views

What are good sample programs for learning to use a debugger?

One skill I teach students in Java 1 is how to use a debugger, specifically: single-stepping through code using breakpoints viewing the values of variables going up and down the call stack I have ...
4 votes
1 answer
123 views

Example for Introduction to Generics in Java

What are some good example classes for introducing generics in Java? I'm introducing this in the context of implementing ArrayList, but I don't want my first ...
1 vote
1 answer
125 views

How to make project in java language, for students who doesn't know java?

In CS I have been taught other programming languages than java. Now in final year project they are demanding project in java. So is there an easy technique to learn java fast?
5 votes
2 answers
292 views

Java or Kotlin for beginners (procedural programming knowledge is existing)?

We are teaching an "introduction to cs" course (bachelor level) and in the first half of a year students are learning the fundamental principles of procedural languages. We are using python 3 and C as ...
2 votes
3 answers
433 views

Why and how is it efficient to process sorted arrays than unsorted arrays?

It is well accepted that processing sorted arrays is easier and efficient. What would be the pedagogical approach to explain how and why it is more efficient to process sorted collections than ...
2 votes
4 answers
495 views

Is it okay to teach C++ to my 7 year old brother?

I was thinking this for quite long, should i teach my little brother about programming in the age of 7-8? Because it will help him in the future in 12th standard and in university life. I want him to ...
4 votes
7 answers
267 views

Mental Model of Type Conformance/Subtype Polymorphism

I'm finding that my CS2 students really struggle with the notions of type conformance and subtype polymorphism in Java. Say we have the following: ...
3 votes
2 answers
237 views

Project based on game 2048

I'm thinking about an assignment based around the game 2048. This would be towards the end of a first programming course at the university level and assumes the students have been introduced to at ...
6 votes
1 answer
295 views

Is there evidence of differences in the outcomes of objects-early vs objects-late?

Here is the essential parts of a (HS) Junior level question from one of our (Canadian) national computing challenges. (http://www.cemc.uwaterloo.ca/contests/computing/2017/stage%201/juniorEF.pdf) ...
7 votes
7 answers
2k views

Example for For vs While Loop (in Java)

I'm looking for a set of concrete examples that illustrates good use cases of using a for vs a while loop for beginners. I feel ...
29 votes
11 answers
8k views

How can we teach good naming practice for students learning Java?

In writing software we name things. In Java we name classes, interfaces, methods, variables, etc. How can we teach both the importance and the skill of choosing good names? What teaching practices ...
5 votes
4 answers
129 views

Use of jshell in AP CS A

I recently installed jshell in my IDE for use in demoing concepts in AP CS A. It came at just the right time as it was a powerful way to teach ArrayLists and its ...
14 votes
4 answers
568 views

The impact of switching to Java 10

Java 9 and 10 were both released recently -- Java 9 was released on Sep. 21st, 2017 and Java 10 was released on Mar. 21st 2018. These two releases contain some very big changes: Java becomes modular ...
6 votes
4 answers
1k views

Motivation for learning C++ when you know Java

I am going to teach a C++ course to students who already know Java. From answers to my previous question, I learned that C++ is substantially harder to master than Java, particularly because of the ...
6 votes
4 answers
507 views

Using Oracle's Java Documentation as a Teaching Tool

I'm in the process of preparing for the second semester of AP CS A (Java). I want to review objects and classes with my students to prepare for our extended focus this semester on inheritance and ...
6 votes
2 answers
392 views

Teaching OOP in Java, to students who already know Java

I am going to teach a course in object-oriented programming in Java, and am looking for materials - textbooks and slides. It is a course for 2nd-year undergrads. In the 1st year, they already learned ...
5 votes
3 answers
344 views

Teaching C++ to students that know Java

I am now teaching an OOP course to 2nd year undergrads. This is actually a course in advanced programming in Java. In the next semester, I am going to teach the same students, a C++ course. From what ...
18 votes
9 answers
2k views

The order of subjects in beginner's curriculum

This year I'll be an unofficial teacher assistant in the CS class of 9th graders. Background This question is about a curriculum for introducing students to programming in java. The students are in ...
-1 votes
1 answer
231 views

Help in choosing elective subject

I am a student of B.Tech CSE and have an option to choose any one of the subjects in the next semester. Below are the options: Enterprise Java Digital Image Processing Compiler Design I want to ...
2 votes
2 answers
140 views

Teaching intermediate Java to students familiar with C

The class I teach (a class whose teacher I assist1, to be precise) is learning intermediate Java this year (data structures, basic OOP and a few lessons about how Java actually works). A few of the ...
4 votes
2 answers
147 views

Choosing Java-like language for teaching web development

I just started teaching an introduction to web development to high school students (they have the most basic knowledge of java) and this year my school has decided to make a change in the curriculum. ...
4 votes
0 answers
682 views

Using zyBooks and labs

Has anyone used zyBooks in their classes? I've seen some good comments on the SIGCSE list about them. I would primarily use this in our CS I class (Java) with their lab feature as a way to provide ...
5 votes
3 answers
690 views

Framework choice for AP CS A students: Swing or JavaFX?

I attended an AP workshop this week to prepare for teaching AP CS A this coming school year. It gave me my first glimpse of Swing, which has now piqued my interest about including some GUI components ...
11 votes
7 answers
381 views

How to illustrate scope problem when creating variables inside `if` statements in Java

One of the problems that my students will stumble upon every year is trying to create or initialize variables within an if/else ...
3 votes
1 answer
109 views

Ideas for introducing databases to Android development students

I teach an Android development course to students who have had two full years of Java experience - including a year of data structures. In the past, my students have used services such as Firebase, ...
5 votes
3 answers
579 views

Lesson plan for teaching java graphics

Background: This lesson should give a firm foundation for graphics in Swing in java to students in high school who know OOP in java (...