Git and GitHub are two different but related tools that are used in
software development.
Git is a version control system. This means that it can track changes to
your code over time, so you can always go back to a previous version if
you need to. Git is also very good at collaborating with other
developers, as it allows you to share your code and work on it together.
GitHub is a hosting service for Git repositories(Projects). This means
that it provides a place to store your Git repositories online, so you can
access them from anywhere. GitHub also provides a number of features
that make it easier to collaborate with others, such as issue tracking,
pull requests, and code reviews.
In short, Git is the tool that you use to manage your code, and GitHub is
the place where you store your code.
Constuctor and Parameterized Constructor in java:
In java, constructor is a special method that is used to initialized an
object when it is created.
Here is an example of a constructor:
Constructor : Parameterized Constructor :
public class Person { public class Person {
private String name; private String name;
private int age; private int age;
public Person() { public Person(String name, int age) {
{
this.name = name; this.name = name;
this.age = age; this.age = age;
} }
} }
public Person(String name, int age) {//Here Person is parameterized
Constructor ager brackets () blank hoti to wo constructor hota and is ka
aur class na name same hota hai iski koi return type bhi nahi hoti.
this.name = name;
this.age = age;
Hum jo class banate hain jaise ye...:
public class Person { // isme person class hai
private String name;
private int age;
ab iske jo objects hain 'Person' aur 'age', Constructor iske objects ko
initialize karta ha
public Person(String name, int age) { // isme Person parameterized
constructor hai jo niche objects ko initialize kar raha hai aur brackets me
objects ki datatype bhi likhi hai ager ye parameters me () kuch na hota
to ye constructor hota
this.name = name;
this.age = age;
Constructor Parameterized Constructor
(1) Parameters
None One or More
(2) Purpose
Initailize an object with default Initialize an object with the
values.eg specific values.eg
public Person() { public Person(String name, int age) {
this.name = "John Doe"; this.name = name;
this.age = 25; this.age = age;
} }
} }