Commit 1aa14c51 authored by Suresh Kumar's avatar Suresh Kumar

Time-Stamp

parent 6c965654
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=1.8
package com.task1;
import java.util.Scanner;
public class StringValidity {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter A Name .. ");
String name = sc.nextLine();
boolean isValid = true;
for (int i = 0; i < name.length(); i++) {
char ch = name.charAt(i);
if (ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z') {
continue;
}
isValid = false;
}
if (isValid) {
System.out.println("\nThe Name " + name + " is a Valid Name.");
} else {
System.out.println("\nThe Name " + name + " is a Invalid Name.");
}
}
}
package com.task3;
import java.util.Scanner;
public class CheckLeapYearOrNot {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter Year... ");
int year = sc.nextInt();
if ((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0)) {
System.out.println("\n" + year + " is a Leap Year");
} else {
System.out.println("\n" + year + " is Not a leap year");
}
System.out.println("\n----- Check Leap Year Or Not ----- ");
}
}
package com.task4;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Calendar;
import java.util.Date;
public class DateFormates {
public static void main(String[] args) {
Calendar cal = Calendar.getInstance();
System.out.println("Current Date : " + cal.getTime());
cal.add(Calendar.MONTH, 1);
System.out.println("After Add One Month in Current Date : " + cal.getTime());
System.out.println(" ----- First Task Done -----");
Calendar cale = Calendar.getInstance();
System.out.println("\nCurrent Date : " + cale.getTime());
cale.add(Calendar.DATE, -15);
System.out.println("After Subsctract Fifteen Days From Current Date: " + (cale.get(Calendar.YEAR)) + " "
+ (cale.get(Calendar.MONTH) + 1) + " " + cale.get(Calendar.DATE) + " " + cale.get(Calendar.HOUR) + ":"
+ cale.get(Calendar.MINUTE) + " " + (cale.get(Calendar.SECOND)));
System.out.println(" ----- Second Task Done -----");
}
}
package task2.com;
public class FindSecondsAndMilliSeconds {
public static void main(String[] args) {
long seconds = System.currentTimeMillis() / 1000l;
long milli = System.currentTimeMillis();
System.out.println("\nSeconds since 1970: " + seconds + "\n");
System.out.println("\nMillisecondsSeconds since 1970: " + milli + "\n");
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment