Chapter 1 Flashcards

1
Q

what is an object oriented programming language

A

This is a language where code is defined in classes and those are instantiated into objects when called upon in runtime.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is the release interfall of new Java versions.

A

Every 6 months.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

List 5 benefits of Java

A
Object oriented, 
Encapsulation, 
Platform independent, 
Robust,
Simple,
Secure,
Multithreaded,
Backward Compatibility,
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a java class

A

A class is a repeatable buildingblock that can be used to build up your programs. A class contains all parts and characteristics of such a building block

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the difference between a object and a class

A

A object is a copy of a class used in runtime.

The (JVM) runtime enviroment uses a class to create a memory object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the two primary elements of a Java Class

A

Methods

Fields (also known as Variables)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what does the {public} keyword do?

A

This is a “acces modifier” that declares the level of exposure to other parts of the java program. Public means any part of the program can use this method or class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what is the minimal syntax required to create a java class.

A
public/private class Car {
}
First the acces modifier keywords
Second the class keyword
Third is the name of the class
And the curly brackets contain the methods and variables
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does the private keyword do?

A

This is a “acces modifier” that declares the level of exposure to other parts of the java program. Private means that this class or method can NOT be used by other parts of the java program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is this : //

A

The begin of a comment in the code. A single line of text that is ignored during runtime.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the correct syntax for a Multiline comment

A

/* (beginning)

  • (lines, repeat until you have enough )
  • / (end of comment)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the difference between a multiline comment and Javadoc comment

A

it starts with /** instead of /* and it is read by the javadoc tool where other comments are ignored.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the JDK

A

Java Developers Kit, everything you need to create and run a Java program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the JRE

A

The Java runtime enviroment is part of the JDK and is the subset of java tools that run a program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what is the correct filename for a Javafile that contains

public class zoo

A
zoo.java
a java file can only contain one public class and the name of the javefile has to match the name of this class.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the main method

A

The main method tells the java enviroment where to begin working.

17
Q

Describe the static keyword

A

The static keyword binds a method to its class name. When other parts of the program call the class the static method is the entry point of this class.

18
Q

describe the void keyword

A

the void keyword is a return type for a method. This type declares that the method won’t return anything and returns control silently.

19
Q

When to use the void keyword

A

use this return type keyword if your method or class does not give a response.

20
Q

what is contained in a method signature between these symbols ()

A

This is the parameter list, A list of variables with the correct types and names. For example
(int month) a integer named month
(string brand) a string named brand
(string[] args) a array of strings or ‘arguments’

21
Q

What is the correct java command to run the Zoo.class inside the city package without args

A

java city.Zoo

22
Q

How do you pass a argument into a object if your value contains a space like - The Netherlands

A

Use quotes, : “The Netherlands” is a single string value for java arguments.

23
Q

How to run a class without compiling it ?

A

Use the full file name of the class. For example Zoo.java instead of just Zoo.

24
Q

In what situation can you run code without compiling it ?

A

This is only possible for a program that is “Single file source code”.

25
Q

What are the valid options to run a program using the java command while passing the classpath to the jre

A
  • cp : java -cp Filestructure ClassName
  • classpath : java -classpath Filestructure ClassName
  • -class-path : java –class-path Filestructure ClassName
26
Q

What are the valid options to compile a program using the javac command while passing the classpath to the jdk

A
  • cp : javac -cp Filestructure ClassName
  • classpath : javac -classpath Filestructure ClassName
  • -class-path : javac –class-path Filestructure ClassName
27
Q

what do the -c and –create options do when using the jar command

A

Creates a new JAR file

28
Q

what do the -v and –verbose options do when using the jar command

A

Prints details when working with JAR files

29
Q

what do the -f and –file options do when using the jar command

A

it passes the filename of the new JAR file to the jar command.

30
Q

what does the -C options do when using the jar command

A

It points to a directory that contains files to be used to create the JAR

31
Q
What is the correct order of the following elements of a java file.
A : Import statements
B : Field declarations
C : Package declaration
D : Method Declarionts
E : Class Declarations
A
1 = C : Package Declaration
2 = A : Import statements
3 = E : Class Declarations
4 = B : Field declrations
5 = D : Method Declarations
32
Q

for java 11 what is the minimum and maximum amount of public classes in a .java file?

A
Minimum = 0 
Maximum = 1
33
Q

Does java allow operator overloading

A

No

34
Q

Java code compiled on windows can run on linux

A

Yes

35
Q

Java has pointers to specific locations in memory

A

No, java points to objects.