Skip to content

Commit 35751fe

Browse files
authored
Merge pull request ronijpandey#37 from atulim/master
Added a line
2 parents 7b0acd8 + 7670493 commit 35751fe

5 files changed

Lines changed: 32 additions & 33 deletions

File tree

JavaDateAndTime.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,18 @@ public class JavaDateAndTime {
1616
public static String getDay(String day, String month, String year) {
1717

1818
int y = Integer.parseInt(year);
19+
/**
20+
* Converts the String type year into integer type y using parseInt() method)
21+
*/
22+
1923
int m = Integer.parseInt(month);
24+
/**
25+
* Converts the String type month into integer type y using parseInt() method)
26+
*/
2027
int d = Integer.parseInt(day);
21-
28+
/**
29+
* Converts the String type day into integer type y using parseInt() method)
30+
*/
2231
Calendar c = Calendar.getInstance();
2332
c.set(y, m-1, d);
2433

Palindrome_or_not.java

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,25 @@
33
Descritpion : A Palindrome number is a number that remains the same when its digits are reversed. Like 16461, for example: we take 121 and reverse it, after revers it is same as original number
44
*/
55

6+
/*
7+
This code is much shorter written in java
8+
*/
69
import java.util.Scanner;
710

8-
class P{
9-
10-
public static void main(String args[])
11+
class Palindrome_or_not
1112
{
12-
int n,x,i,number;
13-
14-
boolean f=true;
15-
16-
Scanner sc= new Scanner(System.in);
17-
18-
number = sc.nextInt();
19-
20-
String str = Integer.toString(number);
21-
22-
String strArr[] = str.split("");
23-
24-
x = str.length();
25-
n=x/2;
26-
for(i=0;i<n;i++)
27-
{
28-
if(strArr[i].compareTo(strArr[--x])!=0)
29-
{f=false;break;}
30-
}
31-
32-
if(f==true)
33-
System.out.print(str +" is palindrome ");
34-
35-
else
36-
System.out.print( str+" is not a palindrome");
13+
public static void main(Sting args[])
14+
{
15+
Scanner x = new Scanner(System.in);
16+
17+
String st=x.next();
18+
String w="";
19+
int i;
20+
for(i=0;i<st.length();i++)
21+
w=st.charAt(i)+w;
22+
if(st.compareTo(w)==0)
23+
System.out.prinltn("Number is Pallindrome");
24+
else
25+
System.out.println("Number is Not Pallindrome");
26+
}
3727
}
38-
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Java-Codes
22
classroom programs of java.
3+
Contains many codes for the sole purpose of encouraging open source development

Root.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* This program is to find value of root node in a tree
22
when value of each node and sum of child nodes of all nodes is given. */
33

4-
package javacodes;
4+
package javacodes; //encapsulates a group of classes into a package called javacodes
55

6-
import java.util.*; //import packages
6+
import java.util.*; //import package of util class
77

88
public class Root{
99

SizeOfNumber.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import java.io.*;
22
import java.util.*;
3-
class SizeOfNumber {
3+
class SIZEOFNUMBER {
44
public static void main(String[] args) {
55
Scanner sc = new Scanner(System.in);
66
int t = sc.nextInt();

0 commit comments

Comments
 (0)