Test 1 Flashcards

1
Q

platform dependent

A

Executable files created from most high-level language source code files are platform dependent. Since such executables are actually machine language files, each can be run only on a certain kind of computer with a particular operating system.

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

Java bytecode

A

Java compilers do not create machine language files. Instead, they create files of Java bytecode.

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

Java Virtual Machine

A

To run a Java program, you must translate the Java bytecode into machine language through a program called the Java Virtual Machine (or Java VM for short). The Java VM is an interpreter, taking the Java bytecode and executing it directly as it translates it into the machine language of the execution platform.

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

portable.

A

Java bytecode is the same on all computers. Bytecode produced by a Java compiler on a Mac can be run on UNIX or Windows systems, and vice versa! That means Java programs are portable. As long as a machine has a Java VM, it can run Java bytecode produced on a completely different kind of system.

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

Java API

A

The Java language comes with a large library of code

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

packages

A

The Java API is organized into packages. Each Java API package consists of related classes that provide all sorts of things from graphical user interface components to code for handling security
The name of each package in the Java API is in the form

java. or javax.

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

JRE

A

Java runtime environment. You must have a copy of the JRE on your system to run Java applications and applets. The JRE contains the JavaVM and the runtime libraries required to execute java programs.

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

JDK

A

Java Development Kit (formerly known as the SDK). To develop Java applications and applets, you need the JDK, which includes the JRE.

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

applets

A

Java applets are special applications that must be run through a web browser or a special “applet viewer.” When a web page with an embedded applet is downloaded, the local Java VM executes the applet.

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

servlets

A

Java servlets are special applications that run on the server side of a client/server architecture. They are often part of interactive Web programs.

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

Control flow diagrams

A

Control flow diagrams are graphs that use the following notations:

Rectangles represent statements (the statement goes inside the rectangle).
Diamonds represent decisions, including loops (the condition goes inside the diamond).
The connections between rectangles and diamonds, rectangles and rectangles, and diamonds and diamonds indicate the flow of control of execution.

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

Software metrics

A

Metrics are quantitative measures (applying a metric gives an actual number). They are supposed to be objective, consistent, and reproducible. There are ongoing attempts to make them relevant to management of software projects. Numerous software metrics cover a variety of properties from lines of code to number of lines of customer requirements!

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

Cyclomatic complexity

A

(also called conditional complexity) is a software metric that measures the number of execution paths through a method. Cyclomatic complexity was developed in 1976 by Thomas McCabe.

Cyclomatic complexity has a formula:

Cyclomatic complexity = #decisions + 1

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

Code coverage

A

Code coverage is a software testing metric. It measures how much of a program’s source code has been tested.
Method coverage. Did you execute each method?
Statement coverage. Did you execute each statement?
Condition/Decision coverage. Was each part of each condition tested with true values and false ones?

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

Static analysis

A

means analyzing your code without executing it.

Static analysis includes:

Code inspections and walkthroughs
Identification of code that is likely to cause errors

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

version control system (VCS)

A

is a software application that enables users to collaborate on authoring and files.
The VCS does version tracking by automatically recording changes to each file in the repository. The record of changes is called the revision history.

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

Index (or Staging area)

A

A file that keeps information on which files will be committed as part of your next revision.

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

Working directory

A

The folder that holds the actual files that you do your work on. This is your workspace.

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

HEAD

A

A file that points to the most recent versions of the files.

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

interface

A

An interface spells out the services that classes must provide by declaring methods but not defining them. Any concrete class that implements an interface defines all of the methods that the interface declares. An interface is essentially a development contract. It ensures that a particular object provides a given set of methods.

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

characteristics of interfaces

A
An interface is declared with the keyword interface.
Interface methods can be abstract (not defined), default (must be called by an instance of a class that implements the interface), or static (must be called by the interface name).
Interface methods that are abstract, static, or default are automatically public.
Methods canot be defined in the interface (no method body) unless they are declared as static, default, or private.
Static interface methods are defined, and they must be invoked via the interface name rather than via any implementing class.
If an interface declares a data member, it is automatically public, static, and final.
Interfaces do not have constructors.
Interfaces are documented exactly like classes.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Implementing interface without defining methods

A

If a class implements an interface without defining all of the methods declared in the interface, then the class must be abstract.

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

declaring interface

A

You can declare a variable as an interface type.
ForSale x; // declaration

But you cannot instantiate it with the interface.
   x = new ForSale(); // DOES NOT WORK
You can instantiate it with a concrete implementing class.
    x = new AirplaneTicket("LHR", "RDU", 988.0);

You can call any of the interface methods on it directly.
if (x.isExpensive()) …

You must cast to its runtime class type before using methods not declared in the interface.
    System.out.println(((AirlineTicket)x).print());
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Static and default interface members

A

Static interface methods are defined in the interface itself. That is, a static interface method has a body that defines its actions. These methods are called without an instance. They are public.
Default interface methods are also defined in the interface. These methods are also public and they provide a default implementation that the implementing classes can optionally override.
You should call static interface methods with the interface name.

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

base class

A

In program design, a base class enables you to factor out what is common and customize what is different among objects with related shapes and behaviors.

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

child

A

create a new base class, then extend that base class to create other classes. A class that extends the base class is called a child of the base.

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

Null constructors in parents

A
If you do not declare any constructor in a class, Java provides a default null constructor.
If you declare a non-null constructor in a parent class but no null constructor, then constructors of its children must make explicit calls to super.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

class hierarchy

A

A class hierarchy consists of a superclass and its descendants.

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

Everything is an Object

A

Every Java class that does not extend another class is considered to be a child of Object, which is a class in the java.lang package. Every class is part of the Object class hierarchy.

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

overloaded

A

When two methods in the same class have the same name, then the method is said to be overloaded. There are several examples of overloading in the Vehicle class hierarchy:

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

overrides

A
When one method in a child class has the same signature (the same name and formal parameter list) as a method in the base class, then the child class method overrides the base class.
There are some restrictions on overriding.

Static. If a method is declared static in the base, only another static method can override it.
If a method is declared static in the child, any method it overrides must be declared static.

Access control. A method that overrides a base class method cannot have more restrictive access than what was declared in the base.

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

hidden

A

If a subclass declares a field (data member) with the same name as one declared in the base, the base class data member is said to be hidden.

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

substitution principle

A

Inheritance in Java follows the substitution principle – whenever a base class type is expected, a child (or descendent) will suffice.

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

downcasting

A

casting down a class hierarchy (from ancestor to descendent, and it is called downcasting.

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

Polymorphism

A

means that objects respond to messages according to their actual types at runtime rather than their declared types. Polymorphism is also called runtime binding or late binding. That is because you cannot always tell what type of object a reference actually points to until the program is executing.
Note: Polymorphism occurs in the contexts of inheritance and interfaces.

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

Polymorphism with interfaces

A

Interfaces are the primary feature of Java that supports polymorphism. With polymorphism, you don’t have to know how a class defines a particular operation, you simply need to know that it does provide it.

Interfaces cannot be instantiated. But you can declare a variable to be an interface type. That variable can reference an instance any class that implements the interface.

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

Casting

A

Casting is required when you attempt to call a method for an object that is not declared in the object’s declared type. The first section of this lesson described casting in the context of an inheritance hierarchy. But it can also be used with interfaces. Again, you need to be careful. Attempts to cast to improper types generate ClassCastExceptions.

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

abstract method.

A

A method that is declared but that does not have a body is an abstract method. You must declare such a method with the keyword abstract, like this:

public abstract String instructions();

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

abstract class,

A
Any class with an abstract method is an abstract class, and it must be declared with the keyword abstract. Classes that are not abstract are sometimes referred to as concrete classes.
Names of abstract methods and classes in UML diagrams are typically in italics.
Any child class that does not define the abstract method instructions() must also be declared as an abstract class.
Here are the defining characteristics of an abstract class:
A class that contains abstract methods must be declared abstract .
It is not possible to create instances of an abstract class.
A class that does not contain abstract methods can also be declared abstract. This is done to make it impossible to create instances of a class.
Every concrete class that extends an abstract class must provide implementation for all abstract methods.
40
Q

Flexibility of interfaces

A

An interface simply specifies behaviors. It is the responsibility of the implementing class to define those behaviors.

41
Q

Object

A
Object defines 11 methods. Four of them are relevant to this course:
public boolean equals(Object o). Indicates whether two Objects are equal. If not overridden, this method returns true if and only if the two Objects have the same identity.
public Object clone() throws CloneNotSupportedException. Returns a duplicate (a clone -- a bitwise copy) of this object. The new Object has the same state as the original. A call to clone() works only if the class type implements Cloneable, else a CloneNotSupportedException is thrown.
public int hashcode(). Returns the hashcode that Java assigns to this object. Hashcodes are used by some code in the Java API for lookups and retrievals.
public String toString(). Returns a string representation of the object. If not overridden, this method returns the address of the object.`
42
Q

CLoning an object

A
public class Thermometer implements Cloneable {
   // ... rest of class definition       
   public Object clone() throws CloneNotSupportedException {
      try {
         return super.clone();
      } catch (CloneNotSupportedException e) {
         throw new CloneNotSupportedException();
      }
   }

Cast is required when calling
Here are some things you should note about the code:

Calls to clone() must take place inside a try/catch block.
If the class does not implement Cloneable, any attempts to call clone() for an instance of the class generated a CloneNotSupportedException.
If a class whose parent is Object does not override clone() to be public, then clone() for that class will not be visible outside the java.lang package.
The return type for clone() is Object. So you must cast to the class for which you are calling clone(). This is illustrated by the statement
Thermometer y = (Thermometer)x.clone();
43
Q

Shallow/deep copy

A

Unless you override clone(), it returns just a bitwise copy of an object. If the only data members of the object are primitive, this would likely suffice. However, if the instance that is cloned contains a reference to another object (a composition relationship), the clone would contain a reference to the same object. This is what is called a shallow copy. The alternative is for the resulting object to contain a clone of the shared object instead. That would be called a deep copy.

44
Q

Access levels

A

There are four access levels:

public. Visible to “the world,” which means to all other classes independent of their relationship to the class where the member is declared.
private. Visible only to the class in which it is declared.
protected. Visible only to child classes and classes in the same package. Child classes in different packages must access the member through super or this rather than through a local variable or instance variable.
default (also called package-private). Visible only to classes in the same package. These members are declared with no access modifier.

45
Q

problem domain

A

A software architect, who designs the solution, might start work by asking “What are the nouns that are important in modeling the problem?” The problem domain, which is the critical context in which the problem lives, suggests several noun

46
Q

three other kinds of classes: besides nouns

A

View classes. These provide the user interface (can be graphical or non-graphical).
Data consumer/generator classes. These could be used for reading/writing data from/to files, or for generating data from within the program itself.
Helper classes. Examples of helper classes include those that do computations or provide internal data structures.

47
Q

collaborators

A

These are its collaborators. Collaboration occurs when a class needs things that it does not have, and it uses other classes to help fulfill its responsibilities.

48
Q

CRC card

A

The class name is written at the top.
The responsibilities are listed on the left.
The collaborators are listed on the right.

49
Q

Limiting responsibilities

A

The reason designers limit themselves to 3 x 5 or 4 x 6 cards is to prevent them from putting too much into a single class. Classes that have too many responsibilities are notoriously difficult to implement correctly and impossible to maintain.

50
Q

Cohesion

A

When you design a class, the members of that class and the operations of that class ought to form a single, coherent unit. Cohesion is the degree to which the members of a class are related to the general purpose of the class. The various class elements should be as closely related as possible.

51
Q

dependency or coupling

A

Classes in a model can be connected in many ways. For example, a class can contain a member that is another class type, or a class can have an operation that requires another class to complete. Such a connection is called a dependency or coupling. If you change one class, then you may need to change the other. You can have dependencies among classes and among packages.

52
Q

Coupling vs cohesion:

A

Coupling and cohesion are usually considered in relation to each other. When you are designing, try to keep coupling low and cohesion high.

53
Q

Encapsulation

A

Encapsulation means gathering together into one package or class all aspects of the entity modeled by that package or class. A consequence of encapsulation is that class data members should be private so they cannot be directly manipulated outside the class. The concrete details of how a class works are hidden inside the class.

54
Q

Principle of Least Knowledge

A

Finally, there is the Principle of Least Knowledge, which is a design guideline for developing software invented 30+ years ago at Northeastern University. It remains solid as a best practice today. The Principle of Least Knowledge holds that each unit should have only limited knowledge of other units (to which is should be closely related). The fundamental notion is that a given object should assume as little as possible about the structure or properties of anything else, including its subcomponents!

55
Q

information hiding

A

The term information hiding means designing a class so that the implementation details for the class are hidden from other classes.

56
Q

class diagram

A

A class diagram of a system (or part of a system) shows its classes and the relationships between them. It is a “static” snapshot that shows how classes are related but not how they interact.

57
Q

associations.

A

The class at the beginning contains an instance (or static) variable of the type of the class at the end.

58
Q

Aggregate/Composition

A

These are kinds of associations. The class at the beginning has a variable (or collection of variables) of the class type at the end. For example, if class A has an array of objects of type class B, then an aggregate would connect A to B. Composition is a stronger form of aggregation, in which the contained object (type B, at the tail) cannot live in the absence of the containing object (type A, at the head).

59
Q

Generalization (Inheritance)

A
Used with inheritance. The class at the beginning of the link is derived from the class at the end.
Generalization links are solid lines with triangular arrowheads at the end (at the "generalization" end). Arrowheads are required.
60
Q

Realization (Implementation)

A

Used with interfaces. The class at the beginning defines all of the methods declared in the interface, which is at the end.

A realization link is dotted, and it has a triangular arrowhead at the end. Arrowheads are required.

61
Q

package

A

A package consists of one or more .class files that occupy a single directory. The Java source for each class must appear in a file that contains a package statement as its first statement, and the name of the package must be identical to its directory name. There is a dependency from package A to package B if changes in a class in B require changes in a class in A.

62
Q

namespaces

A

Programmers use packages to group related classes together and to create namespaces, which determine how a particular name is to be used in a particular context.

63
Q

sequence diagrams

A

Sequence diagrams show what happens when a single message is sent. While class diagrams reveal the architecture of the system, sequence diagrams reveal the actions. For that reason, sequence diagrams are often called dynamic diagrams.

Messages are method calls from one object to another. The top of a sequence diagram shows the objects that whose methods are called. Below each object is its lifeline, which is a dotted line in the diagram that represents the life of the object. The lifeline has a long rectangular bar that represents its activation record (when the call is on the runtime stack). An arrow from one bar to another represents a method call.

64
Q

exception

A

An exception is a signal that an unusual condition has happened, usually something has gone wrong. If the exception is not handled, the program might crash or (perhaps worse) work on corrupted data. In any case, the result of an unhandled exception is that the JVM prints a message showing the name of the exception and the call stack trace showing where it originated.

65
Q

The words try, catch, throw, throws, and finally are keywords:

A

try. Keyword before a block of code where a possible exception is anticipated.
catch. Keyword before a block of code that handles the exception.
throw. Keyword to indicate a new exception object.
throws. Keyword on a method declaration to indicate the method might throw an exception.
finally. Keyword to preface the wrapup code from trying code and catching exceptions.

66
Q

unchecked exceptions

A

These are RuntimeExceptions. Your code is not required to do anything about them. When an unhandled unchecked exception occurs, the JVM prints a stack trace. The program might or might not stop executing, depending in part on whether it is console based or GUI driven.

67
Q

checked exceptions

A

Your code must catch them or explicitly throw them back to the calling code to handle. Examples are FileNotFoundException and IllegalAddressException.

68
Q

Error

A

An Error, which is distinct from an Exception, is an indication of a very serious Java error. Examples include JVM errors and thread death errors. Error and Exception have a common super/parent class, Throwable. Java allows you to catch Errors, but you should not without a really, really compelling reason!

69
Q

catch (Exception e)

A

catch (Exception e) catches any exception. If you want to be able to catch any exception, put it in front of your last catch block.

You should always order your catch blocks from most specific to most general. For example, catch for NumberFormatException would come before catch for Exception.

70
Q

multi-catch exceptions

A

catch (ExceptionType1 | ExceptionType2 name) {
code to execute if either ExceptionType1 or ExceptionType2 occurs
}

71
Q

Finally blocks

A

A try block can have a corresponding finally block. If any code in the try block is executed, then the code in the finally block is guaranteed to be executed. This happens even if an exception occurs.

72
Q

library

A

A library is a built-in or 3rd party collection of code that can be used in mulitple programs. Libraries promote code reuse, offering tools to complete common tasks. Examples of libraries are almost endless, including familar ones such as core Java API and JUnit.
Java libraries are deployed as JAR files (Java ARchive).

73
Q

Application Programming Interface

A

An API, which stands for Application Programming Interface, is a specification for a library. Java APIs come as collections of web pages that describe:

The public classes, interfaces, and methods of the corresponding Java class libraries.
What functionality is available for you (the client) to use from these libraries.
74
Q

Javadoc

A

Javadoc is a tool for creating a type of documentation from Java source code. It is the standard doclet, which is a Java program that generates files of the documentation content that are formatted in a particular way.

75
Q

use case

A

A use case is a step-by-step, detailed description of how the software system provides a service to a user. For example, the set of use cases for an online banking system would include one that described exactly how a user could view an account balance. Use cases can be very complicated, depending on the amount of detail required for the developers.

76
Q

Waterfall software development

A

Waterfall software development is a traditional approach to software development. With waterfall, one phase is completed before the next begins. Go back to the previous phase only if necessary. Waterfall has its drawbacks:

It tends to be brittle, forcing delays in one phase when another drags on. For example, spending a long time analyzing requirements can mean too short a time for implementation.
Waterfall is called heavyweight because there is no flexibility in the order.
Waterfall promotes breaking teams into specialties – designers cannot do analyis or code, for example.
Waterfall makes revisions in requirements or any prior phase difficult to manage once a successive stage has begun.

77
Q

agile or lightweight

A

Agile methodologies place a heavy emphasis on collaboration with the customer throughout the development process. These methodologies allow (and welcome) changes in requirements, even when coding is well under way or even “completed.” Software developers recognize that requirements naturally evolve over time. It is almost impossible for the customers for a software project to spell out in detail all of the features and behaviors they want that software to provide. In effect, analysis occurs throughout the entire development.

78
Q

iterative development

A

Agile methodologies support iterative development with frequent production of working versions of the final system that have a subset of the required features. Each version brings new features.`

79
Q

Refactoring

A

means rewriting code without the intent of changing its logic. It includes:

80
Q

Finite State Machine

A

(FSM) is a computational model consisting of a finite number of states and the transitions between them.

States represent memory. They are the internal information of what has already occurred. FSM is in exactly one state at a time.
Transitions represent the reponse of the model to input. Each transition depends on the current state and input. Transitions can (and usually do) move the FSM from one state to another.

81
Q

transition table

A

You can also describe a finite state machine with a transition table. Each row in the table represents a state. Each column represents the input to the machine.

82
Q

State Design Pattern

A

The State Design Pattern describes an object-oriented approach to FSM problems. The different states are objects, which behave according to their actual types. These states are incorporated into a context, which is another object.

83
Q

design pattern

A

A design pattern is a template for a solution to a commonly occurring software modeling problem. You have already applied a modification of at least one well known design pattern, Model-View-Control. The State design pattern, which is also well known, was discussed in the FSM lesson.

84
Q

MVC is an acronym for the Model-View-Control

A

This formal design pattern is applied to create programs whose user interface is largely independent of the backend model. Java swing, which bundles the View and the Control part together, enables us to follow a modified version of MVC. (Technically, with MVC, the Model communicates with the Control only. The Control communicates with both the Model and the View.)

The important lesson of MVC is that the logic of the backend model is not incorporated into the view (the frames, buttons, labels, and everything else you can see). It is also not incorporated into the control (the actionPerformed or like methods). Instead, the backend logic can stand alone. You can use the identical backend model with different user interfaces.

85
Q

The GoF book organizes software patterns

A

Creational patterns, for creating objects
Structural patterns, for composing classes and objects to form larger structures
Behavioral patterns, for communication among objects

86
Q

s`ingleton design pattern

A
ensure a class has only one instance, and provide a global point of access to it. " *
There must be only one instance of the class.
The class must instantiate itself.
The instance must be accessible to client classes.
The class must maintain its own data.
87
Q

Adapter

A

“convert the interface of one class into another interface clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces. *

88
Q

aliases

A

The picture below shows two objects. The one on the left has two names, myBedsideClock and myAlarmClock. Those names are called aliases since they refer to the same object. A class is a description of a type of object. The objects in our figures are instances of the AlarmClock class.

89
Q

instance variables

A

They cannot be directly accessed from other classes – they can be used only in the Thermometer class methods. Data members such as these are called instance variables.

90
Q

pass-by-value

A
When a method is called, each actual parameter is evaluated, and the value is copied into the memory for the formal parameter. So the formal parameter becomes a new, initialized variable for the execution of the code.
If the formal parameter is a primitive type (such as int or bool), then it is completely independent of the actual parameter except for that initial value. During method execution, changes to the formal parameter have no impact on the actual parameter.
If the formal parameter is a class type that is initialized with a non-null reference to an object, then the formal parameter becomes an alias for that object. Any changes made to the object through the alias will remain after the method stops execution. 
Versus passed-by-reference: The object that the Thermometer parameter refers to is passed by reference
91
Q

Scope and Access

A

While it might seem that scope and access (public, private, etc.) are related, they are not. Public methods, which have class scope, can be accessed outside of the class using an object of the class type. But they cannot be referred to directly, without any object or class modifier (as in object.method as opposed to method).

92
Q

class methods

A

Methods such as main that are static are class methods. They are independent of any instance of the class (independent of any object). Variables that are static are not instance variables. Instead they are class variables – they are shared by the entire class.

93
Q

Static methods

A
Methods that are declared static can access only other members that are declared static.
It is illegal for a static method to access instance variables (non-static data members).
It is illegal for a static method to use the keyword this.
It is illegal to create a static variable that is local to a method. Static variables must be class members instead.
94
Q

namespaces

A

You can give two different classes the same name as long as they are in different packages. The packages provide namespaces so that the compiler can tell which class belongs to which name referred to in the code.

95
Q

package access

A
Classes or class members can have package access, which means any class in the same package can access them.
You can compress a package into a single JAR file (Java archive), which is convenient for deploying applications or downloading.
96
Q

package statement

A

To create a package, put a package statement as the first line in the source code file. Here are some examples:

package csc257;
package graphics;
package com.abc.textutils;
package edu.ncsu.csc216.project1;
Each class in the same package must have the same package statement. Any class that does not have a package statement is in the unnamed or default package.