Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Problem with package

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi

Problem newProblem = new Problem

This time is with the methods in diferent files


i have this two fils and i wont to use the method in the second file








but when i try to compile the cod the mashine say
CAN NOT FIND THE METHOD CreatePanel(Color.color);


I import everything why gives me the problem
everything is public
 
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
The CreatePanel(Color) method is not a static method. You have to have an instance of the Firma.Method class to invoke the CreatePanel().

Firma.Method method = new Firma.Method();
JPanel panel = method.CreatePanel(myColor);

P.S. The Java convention is to begin method names with a lower-case character, and package names are generally all lower-case.
 
Garrett Rowe
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
By the way, in anticipation of your next possible question:


The squert variable on line 11 is not the same as the sqert instance variable on line 4, despite the fact that they have the same name and type.
 
Marshal
Posts: 76450
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Michail Petrov wrote:Problem newProblem = new Problem

Compiler error: it should read

Problem newProblem = new Problem();

JavaRanch error: same question asked here. Please don't. Closing this thread.
 
If you like strawberry rhubarb pie, try blueberry rhubarb (bluebarb) pie. And try this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic