2017 universities Ranking in Pakistan

Here are overall top universities of Pakistan.Some universities are at the top place in engineering fields but others are at Applied science, BA and in IT programs

Monday, 25 March 2019

LinkedList implementation in JAVA

import java.util.Scanner; class Node {   int data;   Node next; } //**********************LinkedList Class**********************// public class LinkedList {  Node head;      public void insert(int d)       {             Node temp=new Node();            temp.data=d;           temp.next=null;  ...

Wednesday, 13 March 2019

Enum class in java (Simple program)

Days.java public enum Days { Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday }; Test.java public class Test { public static void main(String []args) { Days d; Days enumarr[]=Days.values(); for(Days x:enumarr) { System.out.print(x.ordinal());  // it should print the constant value System.out.print(" "+x);   // it should print all the days System.out.print("\n"); } System.out.println("Printing using...

Three dimensional array in java using ForEachLoop

import java.util.*; public class ForEachLoop { public static void main(String []args) { Scanner s=new Scanner(System.in); System.out.println("Enter number of Pages:"); int p=s.nextInt(); System.out.println("Enter number of rows:"); int r=s.nextInt(); System.out.println("Enter number of colums:"); int c=s.nextInt(); int arr[][][]=new int[p][][]; for(int i=0;i<p;i++)         { arr[i]=new int[r][];  ...

Predefined Array-Copy method in JAVA

public class ArrayCopy{ public static void main(String []args) { int arr[]=new int[]{1,2,3,4,5,6,7,8,9,10}; for(int i:arr) { System.out.print(i); } int arr1[]=new int[10]; System.arraycopy(arr,5,arr1,0,5); for(int i:arr1) { System.out.println(i); }...

Tuesday, 12 March 2019

User Define Class array Simple Java program

import java.util.Scanner; public class ZamaCodes { public static void main(String[] args) { Employee E=new Employee(); Employee Earr[]=new Employee[5];         System.out.println(E.getAge());         for(int k=0;k<5;k++)     {          Earr[k]=new Employee();     }         Earr[0].setAge(10); Earr[1].setAge(20);      ...

Find x position in Matrix (JAVA)

 Declare, Instantiate, initialize and print a 2Dimensional array of numbers as follows.                                    Given a matrix and a number x, find the position of x in the matrix if it is present in it else print “Not Found”.   import java.util.Scanner; public class ZamaCodes { public static void main(String []args) ...

Initialize 1-D array of 10 numbers and get minimum and maximum in JAVA

Declare and initialize a one-dimensional array of 10 numbers and get the minimum number of an array using methods. import java.util.Scanner; public class ZamaCodes { public static void main(String []args) { Scanner s=new Scanner(System.in); int arr[]=new int[10]; System.out.println("Enter 10 numbers in an array:"); for(int i=0;i<10;i++) { arr[i]=s.nextInt(); } Zamacodes q=new Zamacodes(); System.out.println("The...

Declaration of one dimensional array of numbers and characters in JAVA

-Declare and initialize two one dimensional arrays with 1) Numbers  2) Characters 1.1-Print the content of both arrays 1.2-Get the length of both arrays and print  import java.util.Scanner; public class SimpleJavaProgram { public static void main(String []args) { int arr[]; Scanner s=new Scanner(System.in); int x; System.out.println("How many elements you want to store in an array?"); x=s.nextInt(); ...