Encyclopedia of Education and Information Technologies

Living Edition
| Editors: Arthur Tatnall

Programming Languages for Secondary Schools, Java

  • Torsten BrindaEmail author
  • Matthias Kramer
Living reference work entry
DOI: https://doi.org/10.1007/978-3-319-60013-0_12-1

What Is Java?

Java is one of the most popular and widely used object-oriented programming languages. According to the TIOBE index (See https://www.tiobe.com/tiobe-index/), which is an indicator of the popularity of programming languages, Java has been among the three most popular programming languages (together with C and C++) for 17 years in 2019 and currently holds and has been holding the top position over a long period of time in the past. The current significance is also confirmed by the annual survey conducted by Stack Overflow, which had more than 100,000 participants in 2018 (See https://insights.stackoverflow.com/survey/2018). Even with the perpetual increase in web development technologies, such as JavaScript and SQL, Java still plays an important role for all participants, from web developers and system administrators up to data scientists. Especially in Europe and India, it guarantees top-paying jobs (See https://insights.stackoverflow.com/survey/2017). Java was designed by James Gosling at Sun Microsystems as a simple, object-oriented, distributed, interpreted, robust, secure, architecture-neutral, portable, high-performance, multithreaded, and dynamic language in the first half of the 1990s (See Sun Microsystems 1995), where it started as a part of a larger project to develop advanced software for consumer electronics and has since then been continuously developed further (initially by Sun Microsystems and since 2010 by Oracle after taking over Sun). The spread of Java began around the mid-1990s and therewith at the time when the World Wide Web gained more and more popularity through web pages created with the Hypertext Markup Language (HTML), related web browsers with a graphic user interface (such as Mosaic and Netscape), and more and more devices being connected to the Internet. This resulted in the need for a compact, yet reliable, robust, and powerful language for developing programs for this scenario (See Claus and Schwill 2006).

The syntax of Java has been consciously oriented at C and C++ to simplify learning for programmers with knowledge of these popular languages and therewith to accelerate the spread of Java. The language provides the typical primitive data types for boolean, characters (char), integers (byte, short, int, long), and floating-point numbers (float, double), in which the different types of a category cover different ranges of values. In order to process many similarly structured data, arrays (or fields) with fixed limits are available. For other data types, Java offers a very extensive class library, e.g., for processing strings; managing data in stacks, lists, trees, or graphs; designing graphical user interfaces; or communicating in networks. In addition, there are numerous freely available class libraries on the net for a variety of purposes. To implement methods using algorithms, Java provides the usual control flow statements, with which elementary instructions can be composed. Elementary instructions are variable declarations with or without assignments, increments or decrements, method calls, or instance generations. Sequences of instructions can be formed for sequential processing. For the decision-driven execution of program parts, simple case distinctions with or without alternative (if-then statement, if-then-else statement) or also with multiple alternatives (switch statement) are available. To control repetitions there are loops for iterating over a range of values (for statement) and over collections (for-each statement) as well as loops checking a condition before the execution of the loops’ body (while statement) or after the execution (do-while statement). Program blocks belonging together are marked with curly braces ({...}). Both classes and methods can be defined using recursion. Constants and specifications can be combined in interfaces that are treated like classes; however they need classes for implementation. Classes and interfaces can be structured into semantically linked packages. A Java program then consists of a sequence of class definitions and interfaces, which can make use of the extensive Java class library and can, but not have to, be structured into one or more packages.

With Java, applications can be created, programs that can be executed directly with the Java interpreter, including apps for the operating system Android for mobile devices, and so-called applets, which are embedded in web pages and run, when a web page is displayed in a web browser. Applications need one single class to define a main method to indicate from where the program should start. Java supports all characterizing concepts of object-oriented development, as collected by Armstrong (2006), such as inheritance, object, class, encapsulation, method, method passing, polymorphism, abstraction, instantiation, attribute, information hiding, and dynamic binding (in descending order of use in definitions).

One of the main strengths of Java is that its programs can be run on all platforms for which an implementation of the Java virtual machine exists. This is the case, for example, for all relevant desktop operating systems. The reason for this is the goal of supporting network applications running on a variety of systems with different operating systems. To achieve this, the Java compiler generates a platform-independent object file format, which can then be executed in the respective Java runtime environment. The generated so-called bytecode is architecture-independent, but can be easily translated into machine code of the executing machine and is thus efficiently executable. In order to allow the development of reliable programs, Java places great emphasis on the early identification of problems at compilation time (strictly typed language, compliance with class interfaces), loading time (testing of bytecodes), runtime (access to null pointers, violation of array limits), and the avoidance of error-prone situations. Therefore, language concepts such as pointer arithmetics, explicit reservation/release of memory, multiple inheritance in classes, and preprocessor statements were not included in the language design to simplify the development process. Because Java was designed for networked/distributed environments, great emphasis was also placed on security. Various security concepts have been implemented in order to prevent program manipulation by inserted parts. Applets from external servers are run in a closed environment (so-called sandbox). This prohibits access to the file system of the executing machine or the execution of programs and allows network access only to the source server. In the event of an infringement, the browser’s security manager aborts the execution.

Java in the Educational Context

Java is widely used and omnipresent as a programming language not only in the field of software development as has been discussed in the former section but also in computing education at universities and secondary schools. At universities, Java is a popular language for the introduction into programming. To clarify the usage of Java in German universities, the authors conducted a survey in the first half of 2017. About 20% of those German universities responded where studying a subject related to computer science was possible. Regarding those universities, the proportion of universities for applied sciences vs. regular universities in our survey (69%:31%) was roughly the same as in the whole country (70%:30%). The geographic distribution of responses also adds to representativeness, since responses from 14 out of 16 states were gathered. Java was used in about 80% of universities for teaching introductory object-oriented programming. Adding to that the number of cases where it is used in later advanced courses, usage of Java was reported in more than 90% of universities. Similar results could be obtained for upper secondary education, where it is frequently used as a text-based programming language after an introduction into programming with a block-based language (e.g., scratch, scratch.mit.edu) in middle schools. Regarding the spread of Java, there are national differences. In Germany, for example, Java is prescribed as the language to be used in central school-leaving exams of upper secondary schools in many of Germany’s federal countries. The same formerly mentioned survey revealed that at least in upper secondary schools in half of all German states, Java was used as one of the text-based languages to teach concepts of object orientation. Of course, the spread in secondary education, higher education, and work life is linked: upper secondary education aims to prepare for future life situations by being practical and near to the learners’ everyday lives and also for subsequent educational phases by following the principle of science propaedeutics. In higher computing education, too, programming languages are used, which are practically relevant for the graduates and which therefore create good job prospects. Because of its more than two decades ongoing development history, Java can be described as a mature programming language that implements the most important concepts of object-oriented programming in a neat way. Java’s popularity and presence over a longer period of time have the consequence that there are numerous introductory and specialized textbooks and online offers such as tutorials or video courses available; in addition numerous research work on the development and testing of learning and teaching concepts for diverse target groups, pedagogically driven comparisons with other programming languages, empirical studies on learning difficulties and actions to avoid these, documented Java examples from various programming projects, and much more. There is also a wide range of freely available tools for Java programming from introductory integrated development environments with diverse visualizations up to professional software development tools with integrated modeling tools and automated source code generation. The availability of all such resources on the WWW supports the learning of the language, and on various platforms, there is fast help for Java questions of any kind.

In secondary schools, Java has spread since the second half of the 1990s. The first documented teaching examples were often characterized by the attempt to implement imperative problem solutions using Java. Over the years, however, numerous high-quality teaching materials (e.g., school textbooks) have been published. In addition, various tools and learning environments have been developed over the course of time, which are apt to support teaching. The availability of such systems can, on the one hand, be seen not only as a strength with regard to instructional usage but also as an indicator of potential learning difficulties with regard to the language, since otherwise learning would be possible without such systems.

Among the systems for education, BlueJ (bluej.org) is a simple and compact programming environment for Java, which supports programming beginners through appropriate visualization of ideas of object orientation. For this purpose, the user is presented, for example, a visualization of the class structure, via which objects can be instantiated, which are then displayed in an object bar. These objects can then be inspected, and their methods can be executed including input of parameter values. BlueJ is therefore often used as an introductory programming environment for Java. Also noteworthy is Greenfoot (greenfoot.org), a widely used learning environment for Java. It can be used to create simple two-dimensional graphical applications. In certain scenarios, the learner is provided with basic functions, which can then be expanded step by step. Particularly interesting is the development of Stride in Greenfoot, a Java-based form of block-based programming. Learners who previously learned to use a block-based programming language can use it to create programs that are block-based, which makes the transition easier. The source code fragments assigned to these blocks can then be developed further on source code level. This allows a connection to didactic concepts for younger learners. There have been also experiments with such interface concepts concerning subsequent educational phases. Thus, an earlier version of the professional programming environment Netbeans was able to open BlueJ projects, thus simplifying the transition from an educational to a professional programming environment. The corresponding plugin, however, is not being further developed.

Because of its spread in the field of education, other successful and tested educational environments have been adapted so that they can be programmed with Java, and existing learning and teaching concepts can be reused. Among them are Turtle, Karel The Robot, Lego Mindstorms, Arduino, and others. In addition, a number of didactic class libraries have been developed that simplify or support Java’s not very intuitive input and output and teaching concepts based on it.

References

  1. Armstrong DJ (2006) The quarks of object-oriented development. Commun ACM 49(2):123–128CrossRefGoogle Scholar
  2. Claus V, Schwill A (2006) Java. In: Duden Informatik A-Z. Fachlexikon für Studium, Ausbildung und Beruf. Dudenverlag, Mannheim, pp 329–332Google Scholar
  3. Sun Microsystems (1995) The Java language environment. White PaperGoogle Scholar

Copyright information

© Springer Nature Switzerland AG 2019

Authors and Affiliations

  1. 1.Computing Education Research GroupUniversity of Duisburg-EssenEssenGermany

Section editors and affiliations

  • Sigrid Schubert
    • 1
  1. 1.Faculty IV: Science and TechnologyUniversity of SiegenSiegenGermany