import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Node{
    int data;
    Node next;
    Node(){
        this.data=0;
        this.next=null;
    }
    Node(int data){
        this.data=data;
        this.next=null;
    }
    Node(int data,Node next){
        this.data=data;
        this.next=next;
    }
}
class Main {
    public static Node arr_ll(int[] arr){
        Node head=new Node(arr[0]);
        Node temp1=head;
        for(int i=1;i<5;i++){
            Node temp=new Node(arr[i]);
            temp1.next=temp;
            temp1=temp1.next;
        }
        return head;
    }
    public static void traverse(Node head){
        Node temp=head;
        while(temp!=null){
            System.out.println(temp.data);
            temp=temp.next;
        }
        
    }
    public static void main(String[] args) {
        System.out.println("Hello world!");
        int[] arr=new int[5];
        arr[0]=1;
        arr[1]=2;
        arr[2]=3;
        arr[3]=4;
        arr[4]=5;
        Node head=arr_ll(arr);
        traverse(head);
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: