diff --git a/Abstract.java b/Abstract.java new file mode 100644 index 0000000..39eea57 --- /dev/null +++ b/Abstract.java @@ -0,0 +1,15 @@ +package Allprogram; +abstract class Shape{ + public int a=3,b=4; + +abstract public void area(); +} +public class Abstract extends Shape { + + + public static void main(String[] args) { + // TODO Auto-generated method stub + + } + +} diff --git a/All.java b/All.java new file mode 100644 index 0000000..6bbc1d3 --- /dev/null +++ b/All.java @@ -0,0 +1,10 @@ +package Allprogram; + +public class All { + public static void main(String args[]) + { + System.out.println("saurbah dwivedi loves urvashi sharma "); + } + + +} diff --git a/Area.java b/Area.java new file mode 100644 index 0000000..093c5cb --- /dev/null +++ b/Area.java @@ -0,0 +1,34 @@ +package Allprogram; + +public class Area { + public int a,b,c; + public float ar; + public void area1(int x) + { + a = x; + ar = (float) (3.14*a*a); + System.out.println(ar); + } + public void area1(int x,int y) + { + a = x; + b = y; + System.out.println(a*b); + } + public void area1(int x,int y,int z) + { + a = x; + b = y; + c = z; + System.out.println(a*b*c); + } + + public static void main(String[] args) { + // TODO Auto-generated method stub + Area sc1 = new Area(); + sc1.area1(4); + sc1.area1(4,5); + sc1.area1(6,5,2); + } + +} diff --git a/Array.java b/Array.java new file mode 100644 index 0000000..2d28cbf --- /dev/null +++ b/Array.java @@ -0,0 +1,35 @@ +package Allprogram; + +public class Array { + static int sum = 0; + public static void main(String[] args) { + // TODO Auto-generated method stub + int a[] = new int [] {33,3,4,13,10}; + //* for(int i=0;i a[j]) + { + temp = a[i]; + a[i] = a[j]; + a[j] = temp; + } + } + } + System.out.print("Ascending Order:"); + for (int i = 0; i < n - 1; i++) + { + System.out.print(a[i] + ","); + } + System.out.print(a[n - 1]); + } + + } + + diff --git a/Time.java b/Time.java new file mode 100644 index 0000000..2b4c62b --- /dev/null +++ b/Time.java @@ -0,0 +1,11 @@ +package Allprogram; + +import java.time.format.DateTimeFormatter; +import java.time.LocalDateTime; + +public class Time { + public static void main(String[] args) { + Time dtf = Time.ofPattern("yyyy/MM/dd HH:mm:ss"); + LocalDateTime now = LocalDateTime.now(); + System.out.println(dtf.format(now)); + } diff --git a/UseofSuper.java b/UseofSuper.java new file mode 100644 index 0000000..277f8a0 --- /dev/null +++ b/UseofSuper.java @@ -0,0 +1,24 @@ +package Allprogram; + +class UseofSuper1 { + public void display() { + System.out.println(" i love u urvashi"); + } +} + +public class UseofSuper extends UseofSuper1 { + public void display() { + super.display(); + System.out.println(" i miss u so much"); + + } + + public void main(String[] args) { + // TODO Auto-generated method stub + UseofSuper obj = new UseofSuper(); + // obj.super.display(); + obj.display(); + + } + +} diff --git a/fibooptimised.java b/fibooptimised.java new file mode 100644 index 0000000..9387fea --- /dev/null +++ b/fibooptimised.java @@ -0,0 +1,33 @@ +package Allprogram; + +import java.util.Scanner; +public class fibooptimised { + public static void main(String[] args) throws Exception { + System.out.println("Enter the value"); + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int j = 0; + int[] gb = new int[n + 1]; + long start = System.currentTimeMillis(); + int fibn = fib1(n, gb); + System.out.println(fibn); + long end = System.currentTimeMillis(); + float sec = (end - start) /10000F; + System.out.println(sec + " seconds"); + } + + public static int fib1(int n, int[] gb) { + if (n == 0 || n == 1) { + return n; + } + if (gb[n] != 0) { + return gb[n]; + } + System.out.println("Hello" + n); + int fibo1 = fib1(n - 1, gb); + int fibo2 = fib1(n - 2, gb); + int fibn = fibo1 + fibo2; + gb[n] = fibn; + return fibn; + } +} diff --git a/package-info.java b/package-info.java new file mode 100644 index 0000000..b094c3c --- /dev/null +++ b/package-info.java @@ -0,0 +1 @@ +package Allprogram; \ No newline at end of file