• Post Reply 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

IntelliJ IDEA - Class

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,


I have a basic challenge in the IntelliJ Idea. Somehow in NetBeans I could do it but in IntelliJ it's not working properly for me.

I would like to create a project:
NameAnyNameOfNamesSomething

Then I would create classes for learning. I mean I would create a ' main ' where the program will run. Then other classes for learn like:
ScannerObjects
TaskOfChallenges
Methods
DataTypes
IfKeyword
DoWhile

and so on.

I need to run a method from the Main class - of course - but when I call a method. I need simple an another class. Not an entire another project.

But somehow the Main class could not see methods and my integers from another class.

I though I needed to write import package NameAnyNameOfNamesSomething  - then do this.


This helps me to organize classes, lessons.


Screen-Shot-2018-11-23-at-15.41.27.jpg
[Thumbnail for Screen-Shot-2018-11-23-at-15.41.27.jpg]
 
Marshal
Posts: 8863
637
Mac OS X VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since I don't see packages in your directory tree. Remove any package statements you have in your source files as well as imports of the shown classes. All supposed to be fine.

Much better though, if you post code instead of the picture, so we could see what you have as class declarations (including package and import statements).
 
Liutauras Vilda
Marshal
Posts: 8863
637
Mac OS X VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
DoWhile sounds a strange name for a class. Maybe if you simply want to run a do loop, you should consider using JShell, which comes with all versions of Java⩾9. Simply write jshell at a terminal/command line.

Campbell's JShell wrote:jshell> String input; do
input ==> null
  ...> {
  ...>    input = scn.next();
  ...>    System.out.print(input);
  ...> } while (!input.equals("stop"));
go
gorun
runwalk
walk stop
stop
jshell>

 
Barbara Fischer
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you guys!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic