The following issues were found
lectures/7-methods/code/src/com/kunal/Overloading.java
6 issues
Line: 8
// fun(67);
// fun("Kunal Kushwaha");
int ans = sum(3, 4, 78);
System.out.println(ans);
}
static int sum(int a, int b) {
return a + b;
}
Reported by PMD.
Line: 20
}
static void fun(int a) {
System.out.println("first one");
System.out.println(a);
}
static void fun(String name) {
System.out.println("Second one");
Reported by PMD.
Line: 21
static void fun(int a) {
System.out.println("first one");
System.out.println(a);
}
static void fun(String name) {
System.out.println("Second one");
System.out.println(name);
Reported by PMD.
Line: 25
}
static void fun(String name) {
System.out.println("Second one");
System.out.println(name);
}
}
Reported by PMD.
Line: 26
static void fun(String name) {
System.out.println("Second one");
System.out.println(name);
}
}
Reported by PMD.
Line: 3
package com.kunal;
public class Overloading {
public static void main(String[] args) {
// fun(67);
// fun("Kunal Kushwaha");
int ans = sum(3, 4, 78);
System.out.println(ans);
}
Reported by PMD.
lectures/8-arrays/code/src/com/kunal/MultiDimension.java
5 issues
Line: 23
// };
int[][] arr = new int[3][3];
System.out.println(arr.length); // no of rows
// input
for (int row = 0; row < arr.length; row++) {
// for each col in every row
for (int col = 0; col < arr[row].length; col++) {
Reported by PMD.
Line: 48
// }
for(int[] a : arr) {
System.out.println(Arrays.toString(a));
}
}
}
Reported by PMD.
Line: 6
import java.util.Arrays;
import java.util.Scanner;
public class MultiDimension {
public static void main(String[] args) {
/*
1 2 3
4 5 6
7 8 9
Reported by PMD.
Line: 13
4 5 6
7 8 9
*/
Scanner in = new Scanner(System.in);
// int[][] arr = new int[3][];
// int[][] arr = {
// {1, 2, 3}, // 0th index
// {4, 5}, // 1st index
Reported by PMD.
Line: 13
4 5 6
7 8 9
*/
Scanner in = new Scanner(System.in);
// int[][] arr = new int[3][];
// int[][] arr = {
// {1, 2, 3}, // 0th index
// {4, 5}, // 1st index
Reported by PMD.
lectures/8-arrays/code/src/com/kunal/ArrayListExample.java
5 issues
Line: 34
// get item at any index
for (int i = 0; i < 5; i++) {
System.out.println(list.get(i)); // pass index here, list[index] syntax will not work here
}
System.out.println(list);
Reported by PMD.
Line: 37
System.out.println(list.get(i)); // pass index here, list[index] syntax will not work here
}
System.out.println(list);
}
}
Reported by PMD.
Line: 6
import java.util.ArrayList;
import java.util.Scanner;
public class ArrayListExample {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// Syntax
ArrayList<Integer> list = new ArrayList<>(5);
Reported by PMD.
Line: 8
public class ArrayListExample {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// Syntax
ArrayList<Integer> list = new ArrayList<>(5);
// list.add(67);
// list.add(234);
Reported by PMD.
Line: 8
public class ArrayListExample {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// Syntax
ArrayList<Integer> list = new ArrayList<>(5);
// list.add(67);
// list.add(234);
Reported by PMD.
lectures/9-linear search/code/src/com/kunal/SearchIn2DArray.java
5 issues
Line: 15
};
int target = 56;
int[] ans = search(arr,target); // format of return value {row, col}
System.out.println(Arrays.toString(ans));
System.out.println(max(arr));
System.out.println(Integer.MIN_VALUE);
}
Reported by PMD.
Line: 17
int[] ans = search(arr,target); // format of return value {row, col}
System.out.println(Arrays.toString(ans));
System.out.println(max(arr));
System.out.println(Integer.MIN_VALUE);
}
static int[] search(int[][] arr, int target) {
Reported by PMD.
Line: 19
System.out.println(max(arr));
System.out.println(Integer.MIN_VALUE);
}
static int[] search(int[][] arr, int target) {
for (int row = 0; row < arr.length; row++) {
for (int col = 0; col < arr[row].length; col++) {
Reported by PMD.
Line: 5
import java.util.Arrays;
public class SearchIn2DArray {
public static void main(String[] args) {
int[][] arr = {
{23, 4, 1},
{18, 12, 3, 9},
{78, 99, 34, 56},
Reported by PMD.
Line: 33
return new int[]{-1, -1};
}
static int max(int[][] arr) {
int max = Integer.MIN_VALUE;
for (int[] ints : arr) {
for (int element : ints) {
if (element > max) {
max = element;
Reported by PMD.
lectures/8-arrays/code/src/com/kunal/MultiAL.java
5 issues
Line: 23
}
}
System.out.println(list);
}
}
Reported by PMD.
Line: 6
import java.util.ArrayList;
import java.util.Scanner;
public class MultiAL {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
ArrayList<ArrayList<Integer>> list = new ArrayList<>();
// initialisation
Reported by PMD.
Line: 8
public class MultiAL {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
ArrayList<ArrayList<Integer>> list = new ArrayList<>();
// initialisation
for (int i = 0; i < 3; i++) {
list.add(new ArrayList<>());
Reported by PMD.
Line: 19
// add elements
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
list.get(i).add(in.nextInt());
}
}
System.out.println(list);
}
Reported by PMD.
Line: 8
public class MultiAL {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
ArrayList<ArrayList<Integer>> list = new ArrayList<>();
// initialisation
for (int i = 0; i < 3; i++) {
list.add(new ArrayList<>());
Reported by PMD.
lectures/6-conditions-loops/code/src/com/kunal/Fibo.java
5 issues
Line: 20
count++;
}
System.out.println(b);
}
}
Reported by PMD.
Line: 5
import java.util.Scanner;
public class Fibo {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int a = 0;
int b = 1;
Reported by PMD.
Line: 7
public class Fibo {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int a = 0;
int b = 1;
int count = 2;
Reported by PMD.
Line: 9
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int a = 0;
int b = 1;
int count = 2;
while (count <= n) {
int temp = b;
Reported by PMD.
Line: 16
while (count <= n) {
int temp = b;
b = b + a;
a = temp;
count++;
}
System.out.println(b);
}
Reported by PMD.
lectures/9-linear search/code/src/com/kunal/SearchInStrings.java
5 issues
Line: 11
char target = 'u';
// System.out.println(search(name, target));
System.out.println(Arrays.toString(name.toCharArray()));
}
static boolean search2(String str, char target) {
if (str.length() == 0) {
Reported by PMD.
Line: 5
import java.util.Arrays;
public class SearchInStrings {
public static void main(String[] args) {
String name = "Kunal";
char target = 'u';
// System.out.println(search(name, target));
Reported by PMD.
Line: 8
public class SearchInStrings {
public static void main(String[] args) {
String name = "Kunal";
char target = 'u';
// System.out.println(search(name, target));
System.out.println(Arrays.toString(name.toCharArray()));
}
Reported by PMD.
Line: 11
char target = 'u';
// System.out.println(search(name, target));
System.out.println(Arrays.toString(name.toCharArray()));
}
static boolean search2(String str, char target) {
if (str.length() == 0) {
Reported by PMD.
Line: 8
public class SearchInStrings {
public static void main(String[] args) {
String name = "Kunal";
char target = 'u';
// System.out.println(search(name, target));
System.out.println(Arrays.toString(name.toCharArray()));
}
Reported by PMD.
lectures/6-conditions-loops/code/src/com/kunal/CountNums.java
5 issues
Line: 16
n = n / 10; // n /= 10
}
System.out.println(count);
}
}
Reported by PMD.
Line: 3
package com.kunal;
public class CountNums {
public static void main(String[] args) {
int n = 45535;
int count = 0;
while (n > 0) {
int rem = n % 10;
Reported by PMD.
Line: 10
int count = 0;
while (n > 0) {
int rem = n % 10;
if (rem == 5) {
count++;
}
n = n / 10; // n /= 10
}
Reported by PMD.
Line: 7
public static void main(String[] args) {
int n = 45535;
int count = 0;
while (n > 0) {
int rem = n % 10;
if (rem == 5) {
count++;
}
Reported by PMD.
Line: 11
while (n > 0) {
int rem = n % 10;
if (rem == 5) {
count++;
}
n = n / 10; // n /= 10
}
System.out.println(count);
Reported by PMD.
lectures/6-conditions-loops/code/src/com/kunal/Loops.java
5 issues
Line: 58
*/
int n = 1;
do {
System.out.println("Hello World");
} while (n != 1);
}
}
Reported by PMD.
Line: 5
import java.util.Scanner;
public class Loops {
public static void main(String[] args) {
/*
Syntax of for loops:
Reported by PMD.
Line: 22
// }
// print numbers from 1 to n
Scanner in = new Scanner(System.in);
// int n = in.nextInt();
// for (int num = 1; num <= n; num++) {
//// System.out.print(num + " ");
// System.out.println("Hello World");
Reported by PMD.
Line: 22
// }
// print numbers from 1 to n
Scanner in = new Scanner(System.in);
// int n = in.nextInt();
// for (int num = 1; num <= n; num++) {
//// System.out.print(num + " ");
// System.out.println("Hello World");
Reported by PMD.
Line: 22
// }
// print numbers from 1 to n
Scanner in = new Scanner(System.in);
// int n = in.nextInt();
// for (int num = 1; num <= n; num++) {
//// System.out.print(num + " ");
// System.out.println("Hello World");
Reported by PMD.
lectures/8-arrays/code/src/com/kunal/PassinginFunctions.java
4 issues
Line: 8
public class PassinginFunctions {
public static void main(String[] args) {
int[] nums = {3, 4, 5, 12};
System.out.println(Arrays.toString(nums));
change(nums);
System.out.println(Arrays.toString(nums));
}
static void change(int[] arr) {
arr[0] = 99;
Reported by PMD.
Line: 10
int[] nums = {3, 4, 5, 12};
System.out.println(Arrays.toString(nums));
change(nums);
System.out.println(Arrays.toString(nums));
}
static void change(int[] arr) {
arr[0] = 99;
}
}
Reported by PMD.
Line: 5
import java.util.Arrays;
public class PassinginFunctions {
public static void main(String[] args) {
int[] nums = {3, 4, 5, 12};
System.out.println(Arrays.toString(nums));
change(nums);
System.out.println(Arrays.toString(nums));
Reported by PMD.
Line: 12
change(nums);
System.out.println(Arrays.toString(nums));
}
static void change(int[] arr) {
arr[0] = 99;
}
}
Reported by PMD.