This is not of my work. This is just my notes.

The mental landscape

Glossary

  • Structured Programming: The structured programming approach to program design was based on the following advice: To solve a large problem, break the problem into several pieces and work on each piece separately; to solve each piece, treat it as a new problem which can itself be broken down into smaller problems; eventually, you will work your way down to problems that can be solved directly, without further decomposition. This approach is called top-down programming.
  • Event handlers: are used to handle asynchronous events.
  • Thread: Each of individual tasks that a CPU is working on is called a thread.

Name and Things

Glossary

  • Literal: The basic building blocks of expressions are literals (such as 674, 3.14, true, and ’X’), variables, and function calls. A data value is stored in the computer as a sequence of bits.
  • Expression: An expression can be a literal, a variable, a function call, or several of these things combined with operators such as + and >. An expression is a construct made up of variables, operators, and method invocations, which are constructed according to the syntax of the language, that evaluates to a single value.
  • Statement: A statement forms a complete unit of execution. The following types of expressions can be made into a statement by terminating the expression with a semicolon (;).
  • equals(): “=” is for assignment. “==” compares the memory locations of String objects, not their contents. “cmp” is a command from Python, not Java. “?” Is the conditional operator. Use “s1.equals(s2)” to compare the contents of String “s1” and “s2”.
  • Block: A block is a group of zero or more statements between balanced braces {}and can be used anywhere a single statement is allowed.
  • Class: A class is the blueprint from which individual objects are created.

Control

Glossary

  • Continuation condition: The continuation condition is executed before each execution of the loop (including the first execution), and the loop ends when this condition is false. In for-loop, it runs at least once, at the beginning of each iteration. In do-while, it runs at least once, at the end of each iteration.
  • Update: The update part is executed at the end of each execution of the loop, just before jumping back to check the condition. In a for-loop, the update runs zero or more times, at the end of each iteration.
  • Switch: is useful for processing lists of menu options.
  • Switch expression type: In particular, note that the expression cannot be a double or float value.

SUBROUTINES

Glossary

  • Static: In a running program, a static subroutine is a member of the class itself.
  • Non-static: Non-static subroutine definitions, on the other hand, are only there to be used when objects are created, and the subroutines themselves become members of the objects.
  • Method: A subroutine that is in a class or object is often called a method.
  • Identifier: The name of an item in a program written in the Java(TM) programming language. In programming languages, identifiers are used for identification purpose. In Java, an identifier can be a class name, method name, variable name or a label.
  • Modifier: The <modifier> that can occur at the beginning of a subroutine definition are words that set certain characteristics of the subroutine, such as whether it is static or not.
  • Access specifier: The modifiers public and private are called access specifiers.
  • Local variables: Variables declared inside subroutines are called local variables.
  • Member variables (Global variables): variables that are not part of any subroutine member variables or global variables.
  • Instance variables: Non-static global variables are called instance variable.
class Test{
int age;
}
  • Class variables: Static global variables are called class variables.
class Test{
static int age;
}
  • Formal Parameters (dummy parameters): Parameters in a subroutine definition are called formal parameters or dummy parameters.
  • Actual parameters (arguments): The parameters that are passed to a subroutine when it is called are called actual parameters or arguments.
  • Signature: In order to call a subroutine legally, you need to know its name, you need to know how many formal parameters it has, and you need to know the type of each parameter. This information is called the subroutine’s signature.

Objects and Instance Method

Notes

  • There is a special portion of memory called the heap where objects live.
  • A reference to an object is the address of the memory location where the object is.
  • The new operator calls a special subroutine called a “constructor” in the class.
  • If your program attempts to use a null pointer / reference illegally in this way, the result is an error called a null pointer exception.
  • When one object variable is assigned to another, only a reference is copied. The object referred to is not copied.
  • A getter and/or setter method defines a property of the class, that might or might not correspond to a variable.
  • The definition of a constructor looks much like the definition of any other subroutine, with three exceptions. A constructor does not have any return type (not even void). The name of the constructor must be the same as the name of the class in which it is defined. And the only modifiers that can be used on a constructor definition are the access modifiers public, private, and protected. (In particular, a constructor can’t be declared static.)
  • The systematic approach to programming, using accepted principles of good design, is called software engineering.
  • A large programming project goes through a number of stages, specification, analysis, design, coding, testing, debugging, maintenance. Together, these stages form software development lifecycle.
  • interface is to be implemented, not to be extended.
  • superclass means parent class.
  • subclass means derived class or base class.
  • Parent base = new Base(); လိုခေါ်လိုက်ရင် (က) constructor ဆိုရင် Parent ကဟာကို အရင်အလုပ်လုပ်တယ်။ ဒါပေမဲ့ constructor ထဲက method ကိုတော့ base ထဲက method ကို ခေါ်ယူတယ်။ (ခ) base.variable ခေါ်လိုက်မယ်ဆိုရင် base ထဲက variable ကို ယူတယ်။

Introduction to GUI Programming

Notes:

  • addActionListener registers an object thisto receive events.
  • button.setText() updates the appearance of a button.
  • event handler is an event listener

References:

Written by

Don’t follow me. I wrote junks here. Follow me on Twitter instead.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store