My Experience while learning Programming Java

 

November 29, 2021

Since it is pretty challenging to learn any thing so called programming language was bit bitter taste for me for the first time back in 2008 when I just started coding those days. 

Although my first known programming language was BASIC where I used to create a very simple but still delightful program that was Multiplication Table for 2, 3 and so on. But its all about your hard work which approach to good things. After learning many years to understand and use of keyword, delimiter, methods, variable, OOPS concept, Object, API and other concept and design put me into this Java Programming world to build and deploy a new application.

So, my effort always will be to make Java as easy learning and understanding programming language to anyone who is trying to crawl in High Level Programming Language.

Few below are my free time effort to make something more simple rather than complicated videos and post that I know. So I am trying to keep everything as simple as ABC. Hope you will like and follow the video and please don't forget to visit my Survey Link where you can answer what you like about this Blog.

https://docs.google.com/forms/d/1BC6KYNXGb-pPoJMWo0j3FJJH8KLm63pZz949l20DcCE/viewform?edit_requested=true 

 I have just posted a very simple if else conditional statement videos here. Its again this videos is completely target to Beginner so its only way and concept to use if else statements. 

Syntax for if else is as under:

  if(condition){

     // your code goes here

     }else{

    //when if condition doesn't work else will be enable and your code or statement goes here  

    }





Syntax for For as well as While loop is as under:

for( data type with variable declare; variable limit; variable increment or decrement){

       //Some Code

}


initialize and declare variable;

while(condition){

//Some Code

variable increment or decrement;

}




May 16 2022

I am happy to be back with the new topic called interface and using Inheritance and Polymorphism concept today. we are creating two classes name SuperClass.java and MyClass.java which have main method on it. While explaining more about the code it's always good to clear with guideline and concept of the topic that will be posting. So lets briefly jump to interface with inheritance and polymorphism.

Inheritance: Since in Java been OOPS concept. We always try to minimize the code reuse the code that is already exist in other class. While the code that we used from other class become Super Class after borrowing there code and the class who borrowed the code to use it in its own class becomes Sub Class or Child class. The keyword to access the inheritance into the other class is "extends". Similarly there are four different ways we can consider the Inheritance 1) Single Inheritance 2) Multi-level Inheritance  3) Hierarchical Inheritance   4) Hybrid Inheritance .

 We can define polymorphism as the ability of a message to be displayed in more than one form using the compile time and runtime accessibility called message overloading and message overriding.

Interface is nothing but the abstract which hold all the non-defined or  methods without body and can be used for the future implementation by other class interfaces cannot be used to create objects. Interface methods do not have a body - the body is provided by the "implement" class. On implementation of an interface, you must override all of its methods. Interface methods are by default abstract and public and cannot be protected or private. Interface attributes are by default publicstatic and final. An interface cannot contain a constructor (as it cannot be used to create objects)

The following is a vey Simple Example of all of the topics.



Any comment or suggestion or addition are highly appreciable.



July 21 2022

This is my second post since I involved in blog. Pretty busy in day to day schedule and different workout make no time for me to reinstate in blog post for sometime however I am glad I am back with new content and will be continuing the post now onward.

Although I started my blog related to programming stuff in Java so many more content will be definitely based on the Java Coding. I will be sharing and discussing with you people about the upgraded version of the program too. Hopefully you will like this content and please don't forget to throw your valuable comment and new ideas in the comment section that you all awesome people have.

So for today I will be personally throw some example related to array in Java. As we know Array in Java is series of elements with same data type store in contiguous memory to reduce the multiple variable declaration and later can be access adding index to unique identifier.





September 26, 2022

Hello all we just saw some array initialization and declaration  so we will further process with array/s with multidimensional in upcoming blog. So today we still work with array and find out more solution on it which will be helpful in coming days to all viewers and learner as well as programmer. 

Lets take look array into deep with more example and description. While moving to array part things we have to sure is initialization and using it program this is basic things need to keep as pre-requisite. For more detail, you can check my previous post. 

Creating class called ArrayClass.java



Any comment or suggestion or addition are highly appreciable.



September 28, 2022

This post is related to Array of Java. Since from my last post I have been focusing more in the Array data part because it will increase the logic thinking to solve the problem as well as structure the data orderly and see how we can achieve the target relating to the problem concisely and easily. The below is the solution of the reversing of the array elements but before that we divided it into two halves and reversing it and other halves again reversing it and bring into one single array. Please let me know if you are stuck or I get somewhere need to be improved. 



 


 

October 3, 2022

Hello there back with new code and hopefully you are getting some ideas about the single dimensional array I guess. If not or stuck some part please feel free to share you query or doubt. Today I am posting something related with array again but in two dimensional form and how to access as matrix paradigm. Guess what just trying to break down into much simpler form so everybody know what code is working and what output will be. So for two dimensional array we need same declaring methodology used to create single dimension array but now here contain row and columns. The below is code attached with solution.





Any comment or suggestion or addition are highly appreciable.




October 10, 2022
In programming world, an array is used as collecting of items or info or data of any kind but same type which are stored in contiguous memory locations just like database in database management system.
As we have been looking the array related topic now and in previous too. I have been keeping more article and connected code based on the program. Today I have just made more new topic in array where we are using multiple array and replace the elements from their position to different other index. The below code has try to explain more easily and precisely so if anything have been confused just lets discuss more in detail in comment box.







October 11, 2022

Good to see you back today coding is again based on array, hopefully you are learning or understanding something more about data management using array from previously posted code with meaningful statement. Here today I am doing something same using array but with different output which might be useful for some user and for some not but I wish from your side to look on the code and if stuck or have some query related to the question than please feel free me to comment in comment section which are open 24 and 7. Below is the code with requirement.






October 18, 2022

This is another pretty interesting post regarding to single dimensional array to find out the great, small and equal number from the elements of given array. Since it sound pretty easy for lot of people but still it good concept to understand how the checking happen in Array with three different input for the beginner to mid-level programmer. Hopefully this post will be another good practicing's program for array to many programmer. Please share your thought and query down below comment section.




 






October 25, 2022

In this post there is some quick info and code about the creating own getter setter for any variable type using generic class since I tried to Simply explain the detail how code is running and how it is connected to each other. Some documentation in the code itself will make some clarification about how and when is good to use some created method.
Hopefully you will like the post and don't forget to put your valuable suggestion or comment in comment box.




Calling Generic Type In Main Class







November 1, 2022
Today topic we are doing something simple but useful in our day to day programming life. The below is code where it show the class and inner class having some properties and basically pulling that information by MyClass the main class and how we are using the variable to pull the info of array and assigning to the inner class instant variable. If you have any query please feel free to share or comment below in comment box. 





November 7, 2022

Today I brought some new code related to java.util.ArrayList and see how to use the class as type for the method. Since, this is little complex topic with implementation but for sure you will be understanding very clearly if you see the code how it working and if still you have some doubt or query than please feel free to write comment with date posted and number of line that makes confusing. I used two different class first is MyClass which is also main class and another is Struct class which also act like struct for MyClass or any other class using this class. Hope to see your valuable comment in comment box.
Hello Everyone today post is something more in detail about the array and class using different instant property to explain about the Struct in Java. Since this is custom Struct can be created by programmer rather than any library of inbuilt struct just like C program.
Here we are trying to see how the one class properties can be worked as other class implementation. So further delay lets dive to example and please just let me know anything new or update to that code to make better struct complex type. 
Thank you and waiting to hear any kind of suggestion or question.







November 12, 2022

In today's post there is some useful coding regarding to interface and abstract method in Java and testing very simplified way to understand how it works in real world scenario. Hopefully you are pretty familiar with the interface and abstract terminology but briefly let's talk about. " It is better to use interface when various implementations share only method signature. Polymorphic hierarchy of value types.The interface cannot contain data fields. You cannot use access modifiers for the method, properties, etc. An interface can inherit multiple interfaces but cannot inherit a class. An interface cannot declare constructors or destructors.
It should be used when various implementations of the same kind share a common behavior. The class can have data fields. You can use an abstract class which contains access modifiers".
If you have still some query and question please feel free to comment and leave your suggestion if had some. 



public class MyClass extends MyClassAbstract{
  /* public void callMeAgain(){
       System.out.println("Call Me Again");
   }*/
    public static void justTestingInterface(MyClassInterface myint){
        myint = new MyClass();
        myint.callMeAgain();
    }
    
    public static void main(String args[]) {
     
     MyClassAbstract one = new MyClass();
     MyClassInterface intface = new MyClass();
     one.helloWorld();
     MyClassAbstract.callMe();//since this method is static so no need of object call
     callMe();//or you can either don't use class name also because it is static
     //and extended to MyClass already so no need of object and class for this method
     justTestingInterface(intface);
    
    }
}

interface MyClassInterface{
    void helloWorld();
    static void callMe(){};// since it is static so method body need to be declare
    void callMeAgain();
}
abstract class MyClassAbstract implements MyClassInterface{
   public void helloWorld(){
        System.out.println("NO Way");
    }
    public static void callMe(){
        System.out.println("Ok Fine");
    }
    public void callMeAgain(){System.out.println("From abstract Class");}
}

/* Output Is:
NO Way
Ok Fine
Ok Fine
From abstract Class
*/


November 18, 2022

Back Again with new topic today I am posting some sorting algorithm code here to know how it work techically and adding new content on it just after sorted value of array how to save in arraylist to increase the size of the array container and trasnversing the arraylist using iterator method and adding to it. While uisng sorting algorithm the time complexity of algorithm is O(n^2) and space is O(1).
The below code in 1 part shows selection sort using primitive data type and in part 2 the selection sort is done using Wrapper class. If you have any question or confusion please fill free to share or comment your valuable content. 

Part-1


Part-2



January 26, 2023

After pausing sometime I am back with some content related to Collections framework Map interface with generally HashMap article. We will be looking some methods available in HashMap that will give multiple way to access the data.
Below is the code with output please feel free to give your comment and suggestion.





January 27, 2023


For today topic will be covering some Exception in Java which is abnormal break of program. There is System as well as Custom/User defined Exception and the last is Error. System defined Exception have two different types Checked and Unchecked Exception. In below figure I/O exception to Runtime Exception is Checked because its throw error during compile time and from Arithmetic to Index out of Bound Exception is Unchecked which means its only throw error during runtime.


 Below is the code for the User defined Exception:









January 31, 2023

Today topic will be discuss around the static block with print statement using PrintStream class of IO.
Source  c-jump.com


Source: o7planning.org

"Java supports a special block, called a static block (also called static clause) that can be used for static initialization of a class. This code inside the static block is executed only once: the first time the class is loaded into memory". Before JDK 1.6 we can run the statement without main method using static block but after 1.6 version its not allowed without main method.







February-12, 2023

Today we are going to review some generic code with wildcard to see the extension of extended or implemented class of Integer or Double from Number.








February-15, 2023

Today story we will be looking for Complex type and passing as array to the constructor of other class to make new objects using Static array. In below class MyClass which is main class hold the complex type Customer class as generic type for ArrayList class and adding the String and Double value using constructor of Customer Class. We have another class Stores which is calling the Customer Class and passing as generic type of ArrayList here also. So we are using different Util Class and passing another class into it and trying to access all the properties and method of two others class. The code below is all clear to see what is it doing but if you have some query or suggestion please feel free to pass the comment in comment box.





Output:



The below is another example which will explain shortly but precisely about how to use the complex type like class and make static array to create new object and use each created new Object using the index number rather than using specific variable for each Objects.








March-1, 2023

Today topic we will be discussing about comparator and comparable interface to compare objects. 
Simple definition and with some example below will hope it will make more sense. Lets see first Java Comparator interface used to order the objects of a user-defined class.
 This interface is found in java.util package and contains 2 methods compare(Object obj1,Object obj2) and equals(Object element).

 In same way  Java Comparable interface is used to order the objects of the user-defined class. This interface is found in java. lang package and contains only one method named compareTo(Object). It provides a single sorting sequence only, i.e., you can sort the elements on the basis of single data member only.












March-10, 2023

In this post we will overview to Collections Framework in Java. Normally we use dynamic form of array when using the Object class or wrapper class to execute faster as well insert , delete, transverse etc. The example below is small but very useful content regarding List of List using different data value inside it. Please comment if you have question regarding to example I will be more than happy to discuss and find out more deeply different approach for the application. 







March-11, 2023

Today's post is related to reversing the list elements using different methods of Collections framework as well as using stream collectors and generic type to check how the class and there function can be used to get desired output in the Java program. Since we know as Java 8 was launched many new featured and configuration was adapted with this JDK version. So stream is also part of it with powerful functional defining capability which reduced a code and give the same output despite of writing multiples lines of code.
If you have any comment or suggestion please feel free to post below in the comment. 









March-19, 2023

This post is related to the   recursive call and as we know it is a method that calls itself to solve a problem by breaking it down into smaller subproblems. Recursive functions can be very useful in programming, but they can also be inefficient if not implemented correctly.

In terms of time complexity, a recursive function can be O(n) or higher, depending on the number of recursive calls it makes. However, if a recursive function has a constant number of recursive calls, it can be said to have a constant time complexity, which is O(1).

First example we will see the recursive call to solve the factorial number and than we will jump to sequential number adding itself with both by formula and recursion and lastly we will see without using looping condition first by stream and another by recursion adding all the elements of an arrays. So Just get relax and try to understand the flow if you are new to programming world.











April-14, 2023

Today topic will be covering little more about functional programming in Java with example distinguishing between traditional Iterator method or imperative way programming and functional programming or declarative way of programming using stream and lambda expression.
Functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids changing state and mutable data. In Java, functional programming is supported through the use of lambda expressions, functional interfaces, and streams. Here's an example of functional programming in Java and how it can be used in daily basis:











Comments

  1. Thanks for sharing this content though its simple but might be good for beginner learner.

    ReplyDelete

Post a Comment