Glossary¶
- command-line arguments¶
When you run a program by entering its associated command at a shell prompt, the text that you include after the program name is called the program’s command-line arguments. This text is interpreted by the shell as an array of strings that it passes into the program when it runs it. The program can use the values of these command-line arguments to adjust its behavior. For several general examples of command-line arguments adjusting program behavior, refer to the Unix Commands chapter. In Java, this array containing the command-line arguments can be referred to using the
main
method’sString[] args
parameter. For more information on how to work with command-line arguments in Java, refer to the Command-Line Arguments chapter.- command-line interface¶
- CLI¶
The term command-line interface (CLI) refers to programming approaches for accepting user input that require the user to enter lines of text to supply values that impact the behavior of the program. In Unix, the shell prompt is an example of a CLI. In Java, a CLI for a program might involve displaying text to the user, reading in user input (e.g., using a Scanner object for standard input), then using that input to change what the program does.
- copy constructor¶
A copy constructor for a class called
A
is the constructorA(A other)
; if a class has a copy constructor, then calling it with a reference to some existing object of the class as its parameter should result in the newly constructed object being a copy. The result is not always guaranteed to be a deep copy, so you should always check the constructor documentation and class documentation for more information before you make any assumptions.- instance method¶
In Java, an instance method is a non-static method of class. Such methods are called “instance” methods for two reasons: i) they are called using reference variables that refer to specific objects or instances of the class; and ii) they have access to the instance variables associated with that particular instance. To call one instance method from another instance method in the same class, the
this
keyword can be used as a reference variable that refers to the current object. If you do not use thethis
keyword to qualify a call to an instance method (e.g.,getFoo()
instead ofthis.getFoo()
), then Java will automatically qualify it for you, assuming the instance method exists.- instance variable¶
In Java, an instance variable is a non-static variable of class that is not local to a method. Such variables are called “instance” variables for two reasons: i) they are called using reference variables that refer to specific objects or instances of the class; and ii) each instance of the class gets its own copy of the variables. Adjusting the value of instance variable for one object does not impact its value in another object, unless additional code is written to explicitly make that happen. To access an instance variable inside an instance method in the same class, the
this
keyword can be used as a reference variable that refers to the current object. If you do not use thethis
keyword to qualify the access (e.g.,x
instead ofthis.x
), then Java will automatically qualify it for you, assuming the instance variable exists and is not shadowed by a local variable.- local variable¶
A variable declared inside of a code block. In Java, a code block can be a loop, method, conditional, etc. Local variables only exist in the block where they are declared. Once the code exits that block, the variable is out of scope.
- manual page¶
Refers to the Unix Manual. Any command on the Unix system can be looked up in the manual by using the
man
command.- primitive variable¶
A variable that stores a value (not a reference). In Java, there are 8 primitive types:
byte
,short
,int
,long
,float
,double
,boolean
, andchar
.- reference variable¶
A reference that either stores the memory address of an object or
null
.- shell¶
A program that serves as the primary end-user, interface to the services provided by an operating system. On a Unix system, the term shell often refers to a CLI program like Bash or Zsh that manages user–system interactions using a prompt.
- shell prompt¶
A command-line shell manages user–system interactions by prompting users for input, interpreting the input, asking the operating to perform interpreted actions (e.g., running another program), and displaying related output. While the exact text that is used when a prompt is displayed is often customized, it is common for that text to end with either
$
or%
. On a Unix system, this is where users enter commands.- standard error¶
A file or stream to which a program writes or prints its error-related output data. Unless redirected, data written to standard error is sent to the same place as standard output. In Java, System.err refers to a PrintStream for standard error. On most Unix systems, a file or symbolic link that represents standard error exists in the file system, typically at
/dev/stderr
.- standard input¶
A file or stream to which a program reads its input data data. Unless redirected, data read from standard input is taken from a user’s terminal keyboard. In Java, System.in refers to an InputStream for standard input. On most Unix systems, a file or symbolic link that represents standard input exists in the file system, typically at
/dev/stdin
.- standard output¶
A file or stream to which a program writes or prints its output data. Unless redirected, data written to standard output is sent to a user’s terminal display. In Java, System.out refers to a PrintStream for standard output. On most Unix systems, a file or symbolic link that represents standard output exists in the file system, typically at
/dev/stdout
.- symbolic link¶
- symlink¶
A symbolic link or symlink refers to a kind of file that links to (i.e., serves as a shortcut to) another file or directory called the link target. On most Unix systems, the ln -s command can be used to create a symbolic link; refer to the manual page for ln for information. For an example that shows how to use ln to create a symbolic link, refer to the “Hosting the API Documentation Website” section in the Javadoc and API Documentation chapter.
- terminal emulator¶
- terminal¶
A terminal emulator is…
- Unix¶
A family of computer operating systems that derive from work performed in the 1970s at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and others. For more information, refer to the Unix Environment chapter.