This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Factorial{ | |
public static void main(String[] args) { | |
int i=10,num,fact=1,count=0; | |
Scanner sc=new Scanner(System.in); | |
num=sc.nextInt(); | |
int n=num; | |
while(num>0){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Prod{ | |
public static void main(String[] args) { | |
Scanner sc=new Scanner(System.in); | |
int n=sc.nextInt(); | |
int max=0; | |
int num=1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
public class Vector1{ | |
public static void main(String[] args) { | |
int arr[][]={{1,2,3},{4,5,6},{7,8,9}}; | |
ArrayList<Integer> l1=new ArrayList<Integer>(); | |
ArrayList<Integer> l2=new ArrayList<Integer>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
interface AdvanceArithmetic{ | |
int divi_sum(int n); | |
} | |
public class MyCalculator implements AdvanceArithmetic { | |
public int divi_sum(int n) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Member{ | |
String name; | |
int age; | |
String phone_number; | |
String address; | |
int salary; | |
Member(String name,int age,String phone_number,String address,int salary){ | |
this.name = name; | |
this.age = age; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Marks{ | |
abstract double getPercentage(); | |
} | |
class A extends Marks{ | |
int sub1,sub2,sub3; | |
int sum; | |
double per; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main3{ | |
Main3(){ | |
System.out.println("Unknown"); | |
} | |
Main3(String Name){ | |
System.out.println(Name); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class even implements Runnable{ | |
synchronized public void run(){ | |
for(int i=1;i<=20;i++){ | |
if(i%2==0){ | |
System.out.println(i); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.sql.*; | |
import java.util.Objects; | |
import java.util.Scanner; | |
public class StudentInfo{ | |
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jdbc", "root", "123456"); | |
Statement s = con.createStatement(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//EXAMPLE OF OVERLOADING CONSTRUCTOR | |
class Overloading { | |
double width; | |
double height; | |
double length; | |
//FIRST CONSTRUCTOR IS CREATED | |
Overloading(double w,double h,double l) { | |
width = w; | |
height = h; |
NewerOlder