Skip to content

Instantly share code, notes, and snippets.

//EXAMPLE OF STACK
class Stack {
int stck[] = new int[10];
int tos;
Stack(){
tos = -1;
}
//METHOD TO ENTER THE DATA IN THE STACK
void push(int item){
//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;
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();
class even implements Runnable{
synchronized public void run(){
for(int i=1;i<=20;i++){
if(i%2==0){
System.out.println(i);
}
}
}
public class Main3{
Main3(){
System.out.println("Unknown");
}
Main3(String Name){
System.out.println(Name);
}
abstract class Marks{
abstract double getPercentage();
}
class A extends Marks{
int sub1,sub2,sub3;
int sum;
double per;
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;
import java.util.Scanner;
interface AdvanceArithmetic{
int divi_sum(int n);
}
public class MyCalculator implements AdvanceArithmetic {
public int divi_sum(int n) {
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>();
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;