Skip to content

Java basic #1518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
- [Lectures](https://www.youtube.com/playlist?list=PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ)
- [Course website](https://www.techwithkunal.com/courses/dsa)
- [Assignments](https://github.com/kunal-kushwaha/DSA-Bootcamp-Java/tree/main/assignments) (solutions can be found on LeetCode)
## this is testing commit
2 changes: 2 additions & 0 deletions SYLLABUS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


- [Complete Git & GitHub Course](https://youtu.be/apGV9Kg7ics)
- [Introduction to Programming](https://youtu.be/wn49bJOYAZM)
- [Types of languages](https://youtu.be/wn49bJOYAZM?t=171)
Expand Down
35 changes: 35 additions & 0 deletions classes/day1/dayOne.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
public class dayOne{
public static void main(String[] args) {
// types of language
// procedural
// functional
// object - oriendted


// static and dynamic language
/*
* STATIC = perform type checking at compile time
* delclare dataytpe before you use it , we need to specifies the data type
* give more control
*
* DYNAMIC = perform type checking at run time
* error will show till program runn
* easy to write code ,
* save time
* no need to declare the datatypes of variables
*
*/


// STACK and HEAP memory
/*
* stack store the refernce pointing the object that is acutlly stored in heap
more than one reference variable of one object

*/
// java follow pass by reference
// it dosent have the pass by copy
// garbage collection : none any reference pointyer is pointd toward this object

}
}
6 changes: 6 additions & 0 deletions classes/day1/dayTwo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public class dayTwo {
/*
* flowchart is used for represnt the flow of the program using a set of symbols such as rectangle , sqauare , oval , parrelogram and etc
* prime or not
*/
}
41 changes: 41 additions & 0 deletions classes/day2/Assignment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import java.util.Scanner;

public class Assignment {
public static void main(String[] args) {
// program to even and odd
// defining the scanner
Scanner input = new Scanner(System.in);
// int a ,b;
// System.out.println("enter the number");
// a = input.nextInt();
// if(a%2==0){
// System.out.println("the number is even");
// }else{
// System.out.println("the number is odd");
// } assignment 1.1

// String name ;
// name = input.next();
// String greet = "hello"+name;
// // System.out.println(greet);

// calc
System.out.println("enter two number");
int a = input.nextInt();
int b = input.nextInt();
System.out.println("enter the operator");
String ch = input.next();
if(ch == "+"){
System.out.println(a+b);
} else if (ch == "-") {
System.out.println(a-b);
} else if (ch == "*") {
System.out.println(a*b);

}else{
System.out.println("worng input");
}


}
}
31 changes: 31 additions & 0 deletions classes/day2/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import java.nio.file.LinkPermission;
import java.security.spec.RSAOtherPrimeInfo;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
System.out.println("this ");
// to display something these have a class know as System
System.out.print("this is a single line");

System.out.println("rahul kumar");

// inputs in java Scanner class
// it is availabe in Scanner class
// Scanner sc = new Scanner(System.in);
// System.out.println(sc.nextInt());

// int a = 2300_000;
// System.out.print(a);

float num;
Scanner sc = new Scanner(System.in);
System.out.println("enter the float number");
num = sc.nextFloat();
System.out.println(num);





}
}
20 changes: 20 additions & 0 deletions classes/day2/TypeConversion.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package day2;

import java.util.Scanner;

public class TypeConversion {
public static void main(String[] args) {
// chainging the type from one datatype to another
Scanner sc = new Scanner(System.in);
// type should be compactable
// destination should be greater than source
// type casting = implicit int to float
// type casting = explicit like float to int
int num = (int)(67.555f);
// System.out.println(num);
int a = 766;
byte b = (byte) (a);
// System.out.println(b);
}
}

19 changes: 19 additions & 0 deletions classes/day2/sum.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package day2;

import java.util.Scanner;

public class sum {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print(("enter the first number "));
int num1 = sc.nextInt();

System.out.print(("enter the second number "));
int num2 = sc.nextInt();
int sum = num2+num1;

System.out.println("the additon is "+ sum);


}
}
15 changes: 15 additions & 0 deletions classes/day2/temperature.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package day2;

import java.util.Scanner;
public class temperature {
public static void main(String[] args) {
Scanner ip = new Scanner(System.in);

System.out.println("enter the celcius ");
float tempC = ip.nextFloat();

float tempF = (tempC * 9/5)+32;
System.out.println("the temp in f is: "+ tempF);

}
}
19 changes: 19 additions & 0 deletions classes/day4/LeapYear.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
public class LeapYear {
public static void main(String[] args) {
int date = 2025;
// System.out.println(leapYear(date));
System.out.println(leapYear(date));
}
public static boolean leapYear(int num){

// leap year must be divisible by 4 ;
// leap year must be divisble by 400 ;
// and it is not divisible by 100;
if ((num % 4 == 0 && num % 100 != 0) || (num % 400 == 0)) {
return true;
}

return false;

}
}
15 changes: 15 additions & 0 deletions classes/day4/TypeCheck.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import java.util.Scanner;
public class TypeCheck {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
char ch = sc.next().trim().charAt(0);
System.out.println(ch);
if(ch =='a' && ch<='z'){
System.out.println("this is lowercase");
}else{
System.out.println("this is lowerCase");
}


}
}
18 changes: 18 additions & 0 deletions classes/day4/countingOccurence.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
public class countingOccurence {
public static void main(String[] args) {
int number = 17385789;
int cnt =0;

while(number>0){

int lastDigit = number%10;
number = number/10;
if(lastDigit ==7){
cnt++;
}

}

System.out.println(cnt);
}
}
19 changes: 19 additions & 0 deletions classes/day4/fib.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import java.util.Scanner;

public class fib {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a =0;
int b =1;
int n = sc.nextInt();
for(int i =0;i<n;i++){
int temp =b;
b = a+b;
a = temp;
System.out.println(b);

}
System.out.println(b+"this is the FIBI");
}

}
17 changes: 17 additions & 0 deletions classes/day4/reversh.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
public class reversh {
public static void main(String[] args) {
int n = 123;
int temp = 123;

int rev =0;
while(n>0){
int rem = n%10;
rev = rev*10+rem;
n=n/10;

}
System.out.println(("this is the reversh "+ rev));
System.out.println(("this is the org "+ temp));

}
}
4 changes: 2 additions & 2 deletions lectures/20-trees/code/AVL/.project
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
</natures>
<filteredResources>
<filter>
<id>1679078569810</id>
<id>1752690996261</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
Expand Down
4 changes: 2 additions & 2 deletions lectures/20-trees/code/Questions/.project
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
</natures>
<filteredResources>
<filter>
<id>1679078569810</id>
<id>1752690996278</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
Expand Down