Menu

Java

——————-Properties———————
Characteristics of an object that users can set, such as the color of a window. Characteristics of a variable. (Primitive & Object)
——————-Properties———————

————————-Java Spring Beans———————
You can either supply constructor arguments or use factory methods for Java Spring beans.

Dependency Injection: Dependency injection works together with a setter method. Two argument for the bean property are required: name & ref. “name” represents the name of the setter method after the “set” part, & “ref” represents the bean that is being used as the injection.
————————-Java Beans———————

———————————-GARBAGE COLLECTION——————————————————————–GARBAGE COLLECTION———————————-Main Method:Garbage-CollectionEvery variable/Object in a Java Main method is completely deleted after the main method is finished compiling.———————————-GARBAGE COLLECTION———————————-

——————————————–SERVELETS & JSP’S——————————————–JSP Bean: Stores information. Should store properties that correspond to instance variables. Characteristics of a Java bean include: -Fields (Strings, int, boolean) -Get & Set methods
Smaple JSP Bean Tag:<jsp:useBean id=”user” class=”beans.User” scope=”session”></jsp:useBean>
A bean session is dependent on the cookie for the bean to persist in the same session.
A Bean must have a default constructor
JSP Scopes:-Request: Lowest level scope.-Session-Application-Page (Learn about this one)——————————————–SERVELETS & JSP’S——————————————–

—————————-INTERFACE—————————-If a class that implemnts an interface, does not define all the methods from the interface, the class becomes an abstract class.
Marker Interface: An empty interface in Java. (Also known as tag interfaces) Declare that a special operation will take place, and that it must be handled with care.
Interfaces only define method signitures with no implementaion. Abstract classes define both method signatures with no implementaion & methods with implementaions. Abstract classes must be extended, whislt Interfaces must be implemented.
You can use interfaces to separate components.
Functional Interface: An interface containing only one method.
An interface in Java cannot be instantiated (But interfaces can be used for upcastin/downcasting when instantiating a class. Also for declarations)MyInterface app = new ClassThatImplementsMyInterface();MyClass app = new (MyInterface) MyClass();—————————-INTERFACE—————————-

 

————————JAVA MEMORY————————Heap: Allocate memory for Objects.Stack: Used for the execution of a thread. A lot smaller than the Heap. Each Thread has it’s own Stack.————————JAVA MEMORY————————

 

—————————-DATA TYPES—————————-Primitive variables saved within the global scope of a class Object are saved in the heap. Primitive variables saved within the scope of a method are saved in the stack of that method.Primitve Data Types cannot be de-referenced. That is, you cannot reffer to a variable by a methoud such as: int a=0; a.getValue(); This would result in a (int cannot be dereferenced) error. On the other hand, an Object Data Type can be dereferenced, that is: Object a=new Object(); a.getValue(); This would result in a successfull calling of this method.
In Java, complex Data Types are data types which are not primitive data types.
If you are going to add elements to the beginning or middle of a List, us LinkedList. Else, use ArrayList.
A HashMap is not sorted in any way.
Main Java collection data structure interfaces: Lists, Map & Set.

 

Arrays have random access to the data they hold. (That is the data is accessed through one step)—————————-DATA TYPES—————————-

 

—————————CLASSES—————————Inner Classes: A inner classes can access varibles from their enclosing class.
Anything marked private in a Class CANNOT be accessed by a reference variable of that class in a different class.—————————CLASSES—————————

 

—————————-FUNCTIONS—————————-Java Native methods: Java methods that call c-code methods.
Java does not really support tail-call-optimization.
Higher-Order-Function: A function that calls other functions & returns other functions.
A closure uses variables that are outside of the function scope.
Java 8 closures: http://bruceeckel.github.io/2015/10/17/are-java-8-lambdas-closures/
Recursive Functions:A recursive method can be a method calling itself. (I think this is actually the definition of a recursive method. A method that calls itself indefinetly until it runs out of stack memory)Using recursive methods is very risky. When using recursive methods you should be very carefull and knowlegeble that your recursive method will for no reason exhaust your base method stack-memory space.Base-Case: A condition within a recursive method that causes a recursive method to terminate. For a base-case to be applied succssfully, the base-case must terminate the recursive method before the programming language memory structure for the particaular method runs out of memory.—————————-FUNCTIONS—————————-

 

——————————–FACTORY PATTERNS——————————–Java Factory Pattenrs. Factory patterns are used to create Java Objects dynamically based on a set of conditions. It separates the conditions that rule on which class should be used during runtime based on certain input or uncertainty.——————————–FACTORY PATTERNS——————————–

 

————————-JAVA VECTOR———————————A vector is a collection of Objects.The increment specifies the number of elements to allocate each time that a vector is resized upward.The vector has a default increment of 10 which can be changed in the initialization of the vector.————————-JAVA VECTOR———————————

 

———————-Synchronized Threading————————-A Java method can be declared witht the “synchronized” keyword in order to make that method be used in synchronization when multiple thrads attempt to access the method.———————-Synchronized Threading————————-

 

———————Java Type Casting——————————Java casting truncates.———————Java Type Casting——————————

 

——————Sorting Algorithms———————Selection-Sort: Scans trhough an array finding the smallest element, and replaces the smallest elements
*************INSERTION SORT*************Insertion Sort:
E D C B A [Original]D E C B A [1 Iteration]D C E B A [1 Iteration]C D E B A [1 Sub-Iteration]C D B E A [1 Iteration]C B D E A [1 Sub-Iteration]B C D E A [2 Sub-Iteration]B C D A E [1 Iteration]B C A D E [1 Sub-Iteration]B A C D E [2 Sub-Iteration]A B C D E [3 Sub-Iteration]*************INSERTION SORT*************——————Sorting Algorithms———————

 

———————–VARIABLE DEFINITIONS———————–Member Variable: A global variable, belonging to a class as a whole. This variable is in the scope of the class itself. (Also known as “instance variable”, and “field”)
Local Variable: A variable in the scope of a method. This variable only exists within the scope of the method that it is defined in.
Dereference: In Java, reference is a term used to describe how when calling an object and accessing properites of the Object, first you must dereference the object with it’s memeory location(Which means looking up the memory location of the Object), then acessing the properties held inside the memory location of the Object.———————–VARIABLE DEFINITIONS———————–

 

——————————ANNOTATIONS——————————Proper annotations in Java are recommended. Such as the “@Override” annotation. With this annotation, you can make sure you are properly overriding a method and not have accidentaly written an incorrect method name.——————————ANNOTATIONS——————————

 

———————————SERIALIZATION———————————Static fields in Java are not serialized.serialVersionUID is a unique ID used for assuring that an Object reader is reading the same Object which the reader expected to be written.When deserializing an object, constructors are not runned.
Serializable Interface: The Java Serializable interface serves the purpose of a marker interface for security purposes, that is to limit writing Objects to a file unless specified by the programmer using the Serizable inteface.———————————SERIALIZATION———————————

 

————————————JAVA KEYWORDS————————————The transient keyword in Java prevents serilization of the field which contains that keyword.
Java “continue” keyword: The Java ‘continue’ keyword returns to the top of the loop, ignoring the code that came after the ‘continue’ keyword.————————————JAVA KEYWORDS————————————

 

——————————-LOOPS——————————-Java enhanced loops use the “Iterable” interface. It uses the next() method of an iterator.——————————-LOOPS——————————-

 

—————————————–DEBUGGING—————————————–It’s basically useless to run a Java application in Eclipse in “Debug” mode if you run the application without breakpoints. USE BREAKPOINTS WHEN DEBUGGING—————————————–DEBUGGING—————————————–

 

—————————————JAVA SPRING—————————————Spring is wide used for Java Web Development & Database Use—————————————JAVA SPRING—————————————

 

——————————————–SERVELETS & JSP’S——————————————–Servlet: A Java Class used to respond to network requests, such as HTTP reqeusts. A controller, which routes HTTP requests to the correct place in the server. Processes the data from submitted by HTML pages.
JSP (Java Server Page): A HTML & Java mixed file.Phases: 1. HTTP request with HTML code & Java Code (JSP) is submitted to webserver by client app. 1. JSP is converted as a Servelet at runtime in the server. (Remeber, a servelet is just a conventional Java class with the “Servelet” specification) 2. Servelet processes the data, and sends back HTML/JSP to the client.

 

Scriplet Tag:<% %>When running a JSP, everything placed within the Scriplet tags (<% %> OR <%= %>), will end up in the DoGet or DoPost method of the Servelet.
Scriplet Tag Indicating a String:<%= %>
Page Directive:<%@ page %>Applies to the whole JSP page.
Comment Tag: <%– Comment Here –%>
JSP Container:AN engine which runs a JSP page. Just Java needs the javac & jvm compiler/engine to execute, a JSP compiler is referred to as a JSP container. Since JSP involves Java & Web Services, a JSP container should contain a Java & Web environment, which c=is all included in Tomcat, which contains a JVM and also handles HTTP requests like Apache. Therefore, Tomcat is a container which not only supports JSP, but a variety of other Web based programming languages and services.
Java dynamic web project.Containing Servelets & JSP. Content received and produced is dynamic.
Tomcat compiles a JSP page into a servelet before running it in the JVM.
A Java class and a Java servelet are basically the same thing, the only difference is that a Java servelet is a Java class that complies to servelet specifications and is optimized to better run in an application server such as Tomcat.——————————————–SERVELETS & JSP’S——————————————–

 

————————————————-GUI————————————————-paintComponent method is called automatically when a graphics on screen must be painted. what does <super.paintComponent(graphicsArg0)> do?: http://stackoverflow.com/questions/28724609/what-does-super-paintcomponentg-do
For spacing (createRigidArea)
Default contentPane in a JFrame: JRootPaneA JRootPane contains: glass, layered, content, & Optional-Menu-Bar panes.
Every EventListener has an  argument containing an EventObject————————————————-GUI————————————————-

 

————————-RANDOM————————-The following code would never work if the object referred to is null:
if(flightList[0]==null) { break; }
This is because if ‘flightList[0]’ is null, before the if condition is evaluated, a nullPointerException will be thrown because flightList[0] will first evaluate to null.
POJO (Plain Old Java Object)————————-RANDOM————————-

 

———————–PASS BY VALUE———————–Pass-By-Value works by copying the value of one variable to another variable. (Notice how I said “value”).
———————–PASS BY VALUE———————–

 

———————–JAVA CASTING———————–Java upcasting is tricky. This is a great example.http://www.phys.lsu.edu/~tohline/PHYS2411/q3.dir/casting.html———————–JAVA CASTING———————–

 

———————————————RANDOM———————————————A coolision in Hash Table happens when two inputs to a Hash Function both produce the same Hash value.
Key–>Hash Function–>Hash value–>Index–>Bucket(Holds actual data)

SLP: Service location protocol
Avoid CTRL + X in eclipse
For dynamically loadinng libraries during runtime (Also known as “Reflection”): Class.forName(“X”);
———————————————RANDOM———————————————