12. Java Date and Time - Introduction | Java | Hackerrank

preview_player
Показать описание


Рекомендации по теме
Комментарии
Автор

Hi,
If you are getting Error as error: package java.time does not exist or something like that then please don't forget to implement the following :


1. Change your Java 7 to Java 8 in editor.


2. Try using full class name including namespace.
To access the class of time namespace. Try something like -
Java.time.classname

I hope it will help you :)

geeksbyte
Автор

Guys just Import the following line
1: import java.time.LocalDate;
2: use Java 8
it should work fine
Great day everyone

jounaidzouiten
Автор

spent waay too much time on this problem. thanks man

MrZanProductions
Автор

you are working nice its very helpfull for us

icarus
Автор

i have also an error on
Solution.java:31: error: cannot find symbol
int a = t.getDayofWeek().name();
^
symbol: method getDayofWeek()
location: variable t of type LocalDate
1 error

ShreyaMishraMCA
Автор

sir in my case its is not localdate.. it is asking calender class and errroer is int cannot be converted into string i..

devarajr
Автор

the error is still coming
i check my program many times but i am uable to find the error

icarus
Автор

do you know how to print day of the entered month day and year?
example:
Month: May
Day: 1
Year: 2021
May 1 2021 is Saturday

BWVidventures
Автор

Error:


Solution.java:15: error: class Result is public, should be declared in a file named Result.java
public class Result{
^
Solution.java:45: error: cannot find symbol
String res = Result.findDay(month, day, year);
^
symbol: method findDay(int, int, int)
location: class Result
2 errors

shushmetgupta
Автор

In my code...
Line 5th is...
Public static String getDay(int day, int month, int year) {
}


°°°°°°°what should i do... I am getting error....plz...help me..

ashumewada
Автор

Its quite good videos but in my hacker rank test LocalDate is not compiling it shows cannot find symbol.even I change java versi9n also

technicalentertainment
Автор

Solution.java:19: error: cannot find symbol
System.out.println(getDay(day, month, year));
^
symbol: method getDay(String, String, String)
location: class Solution
1 error


i am getting this error ....

icarus
Автор

import java.time.LocalDate;
import java.util.Scanner;

public class App {
public static void main(String[] args) {

Scanner scan = new Scanner(System.in);

System.out.println("Enter day: ");
String day = scan.nextLine();

System.out.println("Enter month: ");
String month = scan.nextLine();

System.out.println("Enter year: ");
String year = scan.nextLine();

System.out.println(getDay(day, month, year));

scan.close();

}

public static LocalDate getDay(String day, String month, String year){
int d = Integer.parseInt(day);
int m = Integer.parseInt(month);
int y = Integer.parseInt(year);

LocalDate ld = LocalDate.of(y, m, d);
return ld;
}

}

kvelez
Автор

can you plz give the code of this problem

icarus
welcome to shbcf.ru