Mik Mik - 2 years ago 108
Java Question

Using Java LocalTime.parse method

I am trying to write a simple program in Java.

import java.time.LocalTime;

public class test {
LocalTime openT;
LocalTime closeT;

public test(String ot, String ct) {

this.openT = new LocalTime.parse(ot);
this.closeT = new LocalTime.parse(ct);

When I hover over .parse NetBeans keeps telling me:

Cannot find symbol

symbol: class parse

location: class localTime

I searched high and low but I can't figure out what's wrong here...

Anybody can give me some hint?

Thank you.

Answer Source

Remove the new keyword. The parse method is static.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download