Posts

Showing posts from February, 2019

Pointer Introduction

What is a Pointer? Pointers are very important in C programming because they allow you to easily work with memory locations. They are fundamental to arrays, strings, and other data structures and algorithms. A pointer is a variable that contains the address of another variable. In other words, it "points" to the location assigned to a variable and can indirectly access the variable. Pointers are declared using the * symbol and take the form: pointer_type *identifier  pointer_type is the type of data the pointer will be pointing to. The actual pointer data type is a hexadecimal number, but when declaring a pointer, you must indicate what type of data it will be pointing to. Asterisk * declares a pointer and should appear next to the identifier used for the pointer variable. The following program demonstrates variables, pointers, and addresses:  #include <stdio.h> int main () {     int j = 63 ;     int * p = NULL ;     p = & j ;        

Getters & Setters 

Getters & Setters Getters and Setters are used to effectively protect your data, particularly when creating classes. For each variable, the get method returns its value, while the set method sets the value. Getters start with get , followed by the variable name, with the first letter of the variable name capitalized. Setters start with set , followed by the variable name, with the first letter of the variable name capitalized. public class Vehicle {   private String color ;   // Getter   public String getColor () {     return color ;   } // Setter   public void setColor ( String c ) {     this . color = c ;   } } The getter method returns the value of the attribute. The setter method takes a parameter and assigns it to the attribute. The keyword this is used to refer to the current object. Basically, this.color is the color attribute of the current object.

ACCESS MODIFIERS IN JAVA

public is an access modifier , meaning that it is used to set the level of access. You can use access modifiers for classes, attributes, and methods. For classes, the available modifiers are public or default (left blank), as described below: public : The class is accessible by any other class. default : The class is accessible only by classes in the same package. The following choices are available for attributes and methods: default : A variable or method declared with no access control modifier is available to any other class in the same package. public : Accessible from any other class. protected : Provides the same access as the default access modifier, with the addition that subclasses can access protected methods and variables of the superclass (Subclasses and superclasses are covered in upcoming lessons). private : Accessible only within the declared class itself.

OBJECT ORIENTATION

Object-Orientation Java uses O bject- O riented P rogramming (OOP), a programming style that is intended to make thinking about programming closer to thinking about the real world. In OOP, each object is an independent unit with a unique identity , just as objects in the real world are. An apple is an object; so is a mug. Each has its unique identity . It's possible to have two mugs that look identical, but they are still separate, unique objects. Objects also have characteristics , which are used to describe them. For example, a car can be red or blue, a mug can be full or empty, and so on. These characteristics are also called attributes . An attribute describes the current state of an object. In the real world, each object behaves in its own way. The car moves, the phone rings, and so on. The same applies to objects: behavior is specific to the object's type. In summary, in object oriented programming, each object has three dimensions: identity , attributes , and be

Machine learning

Machine learning gives computers the ability to learn without being explicitly programmed.  It is the ability for computer programs to analyze data, extract information automatically, and learn from it.  So, basically, implementing machine learning means creating algorithms which can learn and make   predictions on data.  Some examples of machine learning:  - Amazon recommendations based on the customer’s browsing and purchasing behavior.  - Google's search engine, that ranks the websites by relevancy.  - Self-driving cars.  - Email spam filters.  All of the systems above learn and improve themselves as more and more data is provided: The more you search and purchase on Amazon, the better recommendations it gives. The more emails you mark as spam, the better the system filters new emails. The more situations the self-driving car navigates, the better it drives.  This is very similar to how we humans learn. A typical example is the problem of classifi