Posts
Inheritance in java
In english inherit means to derive qualities from your ancestors genetically.
Just like this in java also, one class can inherit properties and methods of another class using inheritance.
Child extends Parent { } This is the basic syntax for inheritance, We use extends keyword to inherit a class. The class that inherits is also called the subclass and the class which was inherited is called superclass.
To refer to parent class from child class we use super keyword and we need to construct parent in the child class before we intialize any of our properties in our constructor.
Posts
Strings and Arrays
Strings Strings are immutable and they don’t change once defined. String is a class in java which allows you to initialize a string literal. String can be initialize in two different ways
Declaring strings like a normal data type
String name = "some name"; Initialializing a new class method.
String name = new String("some name"); String comes with various different methods like charAt, contains, replace, replaceAll, trim, split. We cannot use indecies to access chars in a string because they are not iterable.
Posts
Packages in Java
Package A package is a grouping of related types providing access protection and name space management.
Advantages Easy to determine how types are related. Makes sure that your names don’t conflict with the names used in the package. Creating a package import mypackage; Naming Convention Packages solve the naming problem but what if two programmers create packages with the same name. That’s why we have naming convention for packages.
Package names are written in all lowercase.
Posts
Method overloading in java
Method overloading is the process of having mulitple method defination with a single name. The complier knows which one to call on the basis of the signature of the method which ever signature matches the call that method is invoked.
By default while overloading if the contract doesn’t match it tries to type convert and see if any siganture match like you can have a method to add two ints and if you try to call it with chars it will get invoked.
Posts
Data types in java
Java is a very strict language when it comes to types. If you want to do anything remotely complex you need to know what types are available.
For simply declaring a function you need to know what type you’ll return and what types you’ll accept beforehand which makes your life simple and complex at the same time.
It makes your life simple when you’re writing the method but When you’re trying to come up with it’s signature you need to spend time to ensure you’re defining it correctly.
Posts
Starting With Java
Java is a type specific language which is a lot stricter than javascript.
Let’s follow the journey of java code.
First Java code is compiled into byte code by a compiler. Byte code is highly optimised so the code can be run quickly by JVM Java Virtual Machine. JVM combined with some System Library make a JRE Java Run Time Environment. The compiler and the JRE together make JDK Java Development Kit.
Posts
Walk Between PG and Office
This is the story of what goes on in my mind while I’m walking from pg to office or office to pg.
First thing I wanna mention is Ashirwad it’s a house near our office which has a circular tower rising on top of it’s roof which makes it look like a fort it has a big garden I don’t like it much but that circular tower grabs my attentioin every morning I pass by it.
Posts
Division by zero
A human story about science.
Division by zero is a short story by Ted Chiang.
It’s a story about a mathematician proving arithmatic is incosistent. That two is equal to one without using division by zero.
The proof is not important but it’s implication is not on the world but on the mathematician who proved it. I never imagined that if somebody wrote a story about arithmatic being incosistent it would focus on the mental health of the individual who proved it.
Posts
Maharaja trophy final
Exciting match at chinnaswamy stadium. It was friday 26th August 2022 when I went to see the final match of maharaja trophy played between banglore and gulbarga.
I went to the final with few of my friends and it was a lot of fun and the match was worth the money which was not much one ticket costed us around Rs. 110 but the match we saw had us on the edge of our seats the entire team both teams scored more than 200 runs and it was a sight to see.
Posts
Hosting Hugo on GitHub
Hosting your static site on Git Hub. This post assumes that you followed this tutorial to create your hugo static site on local machine.
Create a repo on GitHub To host your site on github you need to create your repo with a particular name
<username>.github.io You should push your repo here.
Add this file to automate github actions name: github pages on: push: branches: - main # Set a branch to deploy pull_request: jobs: deploy: runs-on: ubuntu-20.