Loops are great. But my life saver in Java are the if-else statements. They are really simple and it's really easy to implement them into your code. I say a life saver because you can make the code do whatever you want with the if-else statement. It has a really simple syntax:

I want to make cupcakes. I want chocolate cupcakes with white frosting and colourful sprinkles. These will be the specifications or the templates of my cupcakes. This will be the class. If I bake cupcakes, those would be the objects.

Selection Sort: This is a "search and swap" algorithm. First, it finds the smallest element in the array and then exchanges it with a[0]. Then it finds the smallest element in the subarray from a[1] ... a[n] and replaces the smallest element with a[1]. It continues to do this until the list is completely sorted. The time it takes for this algorithm to sort any array for the worst case is given by t=n^2.

Insertion Sort: In this algorithm, we start sorting with a[0]. We look at the next element, if a[0] is bigger than a [1], it switches their places. Then we look at the relationship between a[1] and a[2], as you would expect if a[1] is bigger than a [2], it switches their places.This goes on until the algorithm reaches to the end of the array. The time it takes for this algorithm to sort any array for the worst case is n^2.

Merge Sort: While there is more than one element in an array:

1)Break the array into two halves.

2)Mergesort the left half.

3)Mergesort the right half.

4)Merge the two arrays into a sorted array.

It continues to divide the array until each part has one element, and then it sorts the array using the insertion sort algorithm. The time it takes for this algorithm to sort any array for the worst case is log(n),which is faster than the previous ones.

Quick Sort: This is the fastest algorithm,on average, known for large n. While there are at least two elements in the array:

1)Divides the array from a random point.

2)Quicksort the left half.

3)Quicksort the right half.

It continues to divide the array until each part has one element, and then it sorts the array using the insertion sort algorithm. This is faster than the prior because it does not have to sort the subarrays after merging them.

Sequential Search: It basically checks every element until the desired element is found in the array.

Binary Search: It divides the array in half and checks the middle element, then it divides the two subarrays again and checks the middle element until the desired element is found. This is way faster than sequential search.

5)AP Computer Science Standard Interfaces and Classes:

A class can inherit another class. The class that inherits is called a subclass, the other is called a super class. For example we have three classes: Person, Student, Teacher. About their relationship we can say that a Student is-a Person and a Teacher is-a Person. However, we cannot say that a Person is-a Student. This is called polymorphism.

Polymorphism is a mechanism that ensures that the correct method is called for an object disguised as a more generic type. To be more clear, lets imagine that we have a solid superclass which contains a cube class and a sphere class and both subclasses contain a getVolume() method which have different formulas. If we call, and assume that solids is an array that contains a number of cubes and spheres:

doublevolume = solids[0].getVolume();

In this case, the compiler knows which object solids[0] is and it will call its own get volume class. So polymorphism helps us deal with an array that contains more than one different type of object.

Why do we us polymorphism?

The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. An important thing to notice is that, also stated above, you don't have to know the exact type of the class you're using, just the base type (in this case, solids), and you will get the right result. This is very useful in more complex systems as well.

Back to properties of Classes in Java;

Java doesn't support multiple inheritance, so one class can only inherit another class. However it can implement multiple interfaces.

An interface is a reference type, similar to a class, that can contain only constants, method signatures, default methods, static methods, and nested types. We can say that interfaces are more abstract than abstract classes and that we have to define all methods in the interface.

An abstract classis aclassthat is declaredabstract—it may or may not includeabstractmethods.Abstract classescannot be instantiated, but they can be subclassed. When anabstract classis subclassed, the subclass usually provides implementations for all of theabstract methods in its parentclass.

Why do we use an Abstract Class?

An interface is like a pure abstract class. Abstract class can be used as a base to ensure that every subclass has this function and implements it accordingly.

Why do we an Interface?

The main use is polymorphism, or the ability to perform the same operation on a number of different objects. If different objects all implement the same interface and have the same method, you can store all of those objects in a Vector, for example, and iterate through the Vector calling that method on each one.

By using abstract classes, you can inherit the implementation of other (non-abstract) methods. You can't do that with interfaces - an interface cannot provide any method implementations.

6)Case Studies(Labs): (Needed files are below)

1)Gridworld: test

2)Magpie Lab: This Lab is aimed to study the natural human language. Like a chatbox. You type a phrase and the computer comes up with an answer. It sounds really complicated and difficult.In fact it is really easy at this level. In my opinion all you need is a basic understanding of java and to use strings and if statements really well.

Main Goal: To be able to use strings, substrings and all its methods properly. Example questions can be found in the zip file down below. For this lab you can solve "Strings Quiz" and "String Quiz 2"

3)Picture Lab: Working with 2D arrays and playing with the pixels of the images.

Online sources, tutorials and teaching available on this page. For help contact Mert Karakas.

www.csinquiry.org and www.codingbat.com are also great websites for practicing.