Saturday, January 12, 2019

Java : How to create an object


public class HelloWorld{
public static void main (String[] args){

System.out.println("Begining of my Hello World");
World worldOne = new World("Jacky World"); // Creating the object of the 'world.java' class
worldOne.printName(); // calling the method from 'world.java'
}
}
public class World{

public String name;

public World(String name){
this.name = name;
}

public void printName(){
System.out.println("My World's name is " + this.name);
}
}

Tuesday, May 31, 2016

Convert From Decimal to Binary

Decimal to Binary Converter
Decimal : Binary:

Thursday, May 26, 2016

Video 2: Find the Totient

Power Modular Calculator

Power Modular Calculator

Power Modular Calculator

Base : Exponent:
Modulus: Answer :
This online calculator works accurately upto 20 digits


Copyright 2000 - 2016 homeworkshortcuts.blogspot.com

Friday, April 1, 2016

Linked List : add function







package blog_linklist;

public class Blog_linklist {

    public static void main(String[] args) {
      
        linklist demo = new linklist();
        demo.add("Avengers", 2015, "fantasy");
        demo.add("Iron Man", 2009, "fantasy");

        demo.display();
    }
   
}



----------------------------------------------
package blog_linklist;
public class linklist {  
   
    public link firstlink;
   
    public linklist(){
    firstlink = null;   
    }
    public void add(String Name, int Year, String Genre){
        link newlink = new link(Name, Year,Genre);
        newlink.next = firstlink;
        firstlink = newlink;
    }
   
    public void display(){
        link  newlink = firstlink;
        while(newlink != null){
        System.out.println(newlink.name + " "+ newlink.year  + " " + newlink.genre);
        newlink = newlink.next;
        }
      }
   


-----------------------------------------------------
package blog_linklist;

public class link {

    public int year;
    public String genre;
    public String name;
    // Creating the next link
    public link next; 

    // creating the constructor
    public link(String Name, int Year, String Genre){
    this.name = Name;
    this.year =Year;
    this.genre = Genre;  
    }
}