Git

What is git push?

           Pushing is important! When you make changes to your program or files that are on GitHub, they need to be pushed in order to be updated. Hence, you are uploading the local repository to the remote repository.

lol

What is happening here?

The remote repository hasn’t caught up to the local repository but after pushing, it catches up.

Two ways of pushing

Using the Desktop application

  1. Download the desktop app from the website https://desktop.github.com/
  2. Link your GitHub account.
  3. Clone or add a directory to the local computer to work on
  4. When changes are made to your files, GitHub desktop will automatically recognize these changes and will ask you to push the changes with a message.

Accessing someone’s remote

git remote add remoteName url_of_the_repository

References

https://www.atlassian.com/git/tutorials/syncing/git-push https://gist.github.com/albatrocity/1201187

Java: Access Modifiers

What is an Access modifier?
Access modifiers are keywords used to specify the accessibility of a class (or type) and its members. These modifiers can be used from code inside or outside the current application. 

  • Private
  • Default
  • Protected
  • Public

Private: Data members and methods that are declared private are used on within that specific class it was declared in. A private keyword is used to declared a data member or a method private.
Syntax: private type variable;

Default: The data members, methods can only be used within the same class or a the package where it was declared in.When a data member or a method isn’t declared with an access modifier, it will be a default access modifier.
Syntax: type variable;

Protected: The data members and methods using the protected keyword can only be accessed within the same package and any subclasses.
Syntax: protected type variable;

Public: The data members and methods can be accessible everywhere throughout the program.
Syntax: public type variable;

Non Access Modifers

  • Static – A static variable belongs to a class rather than an instance of a class.
  • Final – A final variable is basically unchangeable.
  • Abstract – Abstract classes cannot be instantiated but they can be subclassed. They are basically used as templates for other classes.

Example Program – Public

abstract class Dog{
    abstract void bark();
}

class Golden_Retreiver extends Dog{
    static String dad_name = "Melo";
    protected String dad_Species = "Golden Retriver";
    public int age = 10;
    void bark()
    {
        System.out.println("Bow Wow");
    }
}

public class Golden_Doodle{
    Golden_Retreiver gr = new Golden_Retreiver();
    public String name = "Kobe";
    String my_dad_name = Golden_Retreiver.dad_name;           
    int dad_age = gr.age;

    void print(){
        System.out.println("Dad's age:" + dad_age);
    }
        public static void main(String[] args) {
            Golden_Doodle kobe = new Golden_Doodle();
            Golden_Retreiver gr = new Golden_Retreiver();
            kobe.print();
            gr.age = 15;
            kobe.dad_age = gr.age;
            System.out.println("Dad's age after 5 years:" + kobe.dad_age);
        }
}

Example Program – Private

abstract class Dog{
    abstract void bark();
}

class Poodle extends Dog{
    protected String mom_name = "kai";
    protected String mom_species = "Poodle";
    private int age = 9;
    void bark()
    {
        System.out.println("wow Wow wow wow wow");
    }
}

public class Golden_Doodle extends Poodle{
    Golden_Retreiver gr = new Golden_Retreiver();
    public String name = "Kobe";
                        
    //Accessing the Private attribute (Would Generate an error)
    int mom_age = super.age;                                
   
        public static void main(String[] args) {
           
        }
}

Example Program – Protected

abstract class Dog{
    abstract void bark();
}

class Poodle extends Dog{
    protected String mom_name = "kai";
    protected String mom_species = "Poodle";
    private int age = 9;
    void bark()
    {
        System.out.println("wow Wow wow wow wow");
    }
}

public class Golden_Doodle extends Poodle{
    Golden_Retreiver gr = new Golden_Retreiver();
    public String name = "Kobe";
    //Accessing the protected attribute
    String my_mom_name = mom_name;                            
    
    //Accessing the protected attribute
    String my_mom_species = mom_species;                      
                                 
    void print(){
        System.out.println("Dog's Name: " + name + "\n" + "Mom's name: "+ my_mom_name + "\n" + "Mom's Species: " + my_mom_species);
        System.out.println("Dad's name:" + my_dad_name);
        System.out.println("Dad's age:" + dad_age);
    }
        public static void main(String[] args) {
            Golden_Doodle kobe = new Golden_Doodle();
            Golden_Retreiver gr = new Golden_Retreiver();
            kobe.print();
            gr.age = 15;
            kobe.dad_age = gr.age;
            System.out.println("Dad's age after 5 years:" + kobe.dad_age);
        }
}

Example Program – Final

abstract class Dog{
    abstract void bark();
}

class Golden_Retreiver extends Dog{
    static String dad_name = "Melo";
    protected String dad_Species = "Golden Retriver";
    final int age = 10;
    void bark()
    {
        System.out.println("Bow Wow");
    }
}

public class Golden_Doodle{
    Golden_Retreiver gr = new Golden_Retreiver();
    public String name = "Kobe";
    
    void print(){
        System.out.println("Dad's age:" + dad_age);
    }
        public static void main(String[] args) {
            Golden_Doodle kobe = new Golden_Doodle();
            Golden_Retreiver gr = new Golden_Retreiver();
            kobe.print();
            gr.age = 15;
            kobe.dad_age = gr.age;
            System.out.println("Dad's age after 5 years:" + kobe.dad_age);
        }
}

Example Program – Static

abstract class Dog{
    abstract void bark();
}

class Golden_Retreiver extends Dog{
    static String dad_name = "Melo";
    protected String dad_Species = "Golden Retriver";
    public int age = 10;
    void bark()
    {
        System.out.println("Bow Wow");
    }
}


public class Golden_Doodle extends Poodle{
    Golden_Retreiver gr = new Golden_Retreiver();
    public String name = "Kobe";
    
    String my_dad_name = Golden_Retreiver.dad_name;           
    int dad_age = gr.age;

    void print(){
        System.out.println("Dad's name:" + my_dad_name);
    }
        public static void main(String[] args) {
            Golden_Doodle kobe = new Golden_Doodle();
            kobe.print();
            }
}

Conclusion

Basically, access modifiers are used to restrict access to data members and classes.

Jake Castle

He doesn’t really understand computer science very well and needs a lot of help trying to understand what goes on with code. His struggles start with the basics. Due to his poor basics, he could never grasp the essentials of another language that depend on the fundamentals. That’s why I will be posting articles about Java, Object oriented programming, SQL, Spring Framework, & angular. This poor should needs to accomplish this task as soon as possible before it is too late…

Basic Layout of the Blog-posts=

  1. Title – concept/interview question
  2. Basic Explanation
  3. In-depth Explanation
  4. Diagram or a picture
  5. Code snippets
  6. In layman’s terms
  7. References

Every blog post will follow the same format. Each article will contain a title that will explain the purpose of the article and what Jake will hope to learn that day. It will be followed by a basic to more in-depth explanation. Diagrams will be included for most topics. They can be flowcharts, tables, drawings, UML diagrams, ER diagrams etc… For each of the topics, there will be a code example. This code example will be simple enough for Jake to understand. Remember, Jake isn’t very bright so he needs very simple problems to understand the topics. And finally, I will give a metaphorical example to the concept so it gets drilled into his head. Jake will not be able to talk technical right away so I’ll help him out by giving him so easy comparisons. The article will end with references. These references can be used to do further reading and citations.

Design a site like this with WordPress.com
Get started