Commit fd2d9a7d authored by Suresh Kumar's avatar Suresh Kumar

Time-Stamp

parent 98abdc91
/.metadata/
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Servers</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Time-Stamp</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
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("Date: " + (cal.get(Calendar.MONTH)+1)+ "-" + (cal.get(Calendar.DATE)) + " Time : "+cal.get(Calendar.HOUR) + ":" + cal.get(Calendar.MINUTE)
// + ":" + cal.get(Calendar.SECOND) + "-" + (cal.get(Calendar.YEAR)) );
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
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>WebApplicationUsingServletJsp</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>WebApplicationUsingServletJsp</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
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