Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8482545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:51:21+00:00 2026-06-10T19:51:21+00:00

obviously my Java Pause was too long… I have the following classes: public class

  • 0

obviously my Java Pause was too long…

I have the following classes:

public class TimeLine {

    public static final String TIME_LINE_DATE_FORMAT = "dd.MM.yyyy";


    public TimeLine(Context context, LinearLayout layout)
    {
        this.context = context;
        this.layout = layout;           
    }

    // some methods and stuff

    public static Date getDateFromString(String dateString)
    {
        SimpleDateFormat s = new SimpleDateFormat(TIME_LINE_DATE_FORMAT);
        try {
            return s.parse(dateString);
        } catch (ParseException e) {            
            e.printStackTrace();
            return null;
        }
    }
}

I use the parsing of a String to a Date quite often, that’s why I wanted to have this function only 1 time & static.

I try to access it like this:

public class TrackedValue {

    private double value;
    private String unit;
    private Date date;

    public TrackedValue()
    {       
    }

    public TrackedValue(Date date, String unit, double value)
    {
        this.date = date;
        this.unit = unit;
        this.value = value;
    }

    public TrackedValue(String dateString, String unit, double value)
    {      
        this.date = TimeLine.getDateFromString(dateString); //Here's the error
        this.unit = unit;
        this.value = value;
    }

    // some getters and setters here

}

This brings me the error:
The method getDateFromString(String) is undefined for the type timeline

Err… why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:51:21+00:00Added an answer on June 10, 2026 at 7:51 pm

    Why can't I call a static method in the constructor of a class?

    You can call static method in your constructor and no one can stop you unless you don’t have access to the method like access modifier restriction.

    There could be problem in your import statement .Please check TimeLine class is there or is this imported correctly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a simple Java class like this: public class User { String
I have Java classes like this: public class Config { public Config1 getConfigOpt1(); public
Obviously, Java does not have delegates or functions as first class values and uses
I have to do a final project for my computational linguistics class. We've been
I have an application where I obviously create too many objects, i get this
I'm running a program in Java which performs a long process. Obviously this causes
(All of the following is to be written in Java) I have to build
So, the TreeMap class in java is of the form TreeMap<K,V> . Obviously K
In java <1.5, constants would be implemented like this public class MyClass { public
I have a method inside one of my classes to my Java application that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.