Why doesn't println() read my package that I've created?
I've written a program and it works but not the way I wish it to be. So I made a package and when I am trying to put my package into my print()
statement it says symbol cannot be found but I imported it at the top.
This is the code I have so far:
//Program is is beng made to graph students incorrect entries
import java.util.*;
import java.io.*;
import java.util.Scanner;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.util.List;
import java.lang.ArrayIndexOutOfBoundsException;
import utils.*;
public class Histo
public static void main(String args) throws FileNotFoundException
Scanner textFile = new Scanner(System.in);
System.out.println("Enter integers that are less than 25, one per line, hit control + z, when finished");
intscores = new int[26];
while( textFile.hasNext())
int startStar = textFile.nextInt();
scores[startStar]++;
for ( int stars = 0; stars < scores.length; stars++)
if (scores[stars] != 0)
System.out.print( stars + " ");
for ( int n = 1; n <= scores[stars]; n++)
System.out.print("*" + TextKit.lineOfStars);
System.out.println();
java
add a comment |
I've written a program and it works but not the way I wish it to be. So I made a package and when I am trying to put my package into my print()
statement it says symbol cannot be found but I imported it at the top.
This is the code I have so far:
//Program is is beng made to graph students incorrect entries
import java.util.*;
import java.io.*;
import java.util.Scanner;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.util.List;
import java.lang.ArrayIndexOutOfBoundsException;
import utils.*;
public class Histo
public static void main(String args) throws FileNotFoundException
Scanner textFile = new Scanner(System.in);
System.out.println("Enter integers that are less than 25, one per line, hit control + z, when finished");
intscores = new int[26];
while( textFile.hasNext())
int startStar = textFile.nextInt();
scores[startStar]++;
for ( int stars = 0; stars < scores.length; stars++)
if (scores[stars] != 0)
System.out.print( stars + " ");
for ( int n = 1; n <= scores[stars]; n++)
System.out.print("*" + TextKit.lineOfStars);
System.out.println();
java
2
Your package or your class? Also I do not see an import forTextKit
– GBlodgett
Nov 15 '18 at 2:00
@Sakura.Mom Do import the package which containsTextKit
class first. Then, check the code again. It'll definitely work!
– Abhinav
Nov 15 '18 at 6:50
I used import java.util.*; to retrieve my TextKit package but I I will give it a try thank you so much
– Sakura.Mom
Nov 15 '18 at 8:56
Why do you thinkTextKit
is in java.util? It isn't, as you see when you click on the link and read the docs.
– Clijsters
Nov 15 '18 at 9:14
add a comment |
I've written a program and it works but not the way I wish it to be. So I made a package and when I am trying to put my package into my print()
statement it says symbol cannot be found but I imported it at the top.
This is the code I have so far:
//Program is is beng made to graph students incorrect entries
import java.util.*;
import java.io.*;
import java.util.Scanner;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.util.List;
import java.lang.ArrayIndexOutOfBoundsException;
import utils.*;
public class Histo
public static void main(String args) throws FileNotFoundException
Scanner textFile = new Scanner(System.in);
System.out.println("Enter integers that are less than 25, one per line, hit control + z, when finished");
intscores = new int[26];
while( textFile.hasNext())
int startStar = textFile.nextInt();
scores[startStar]++;
for ( int stars = 0; stars < scores.length; stars++)
if (scores[stars] != 0)
System.out.print( stars + " ");
for ( int n = 1; n <= scores[stars]; n++)
System.out.print("*" + TextKit.lineOfStars);
System.out.println();
java
I've written a program and it works but not the way I wish it to be. So I made a package and when I am trying to put my package into my print()
statement it says symbol cannot be found but I imported it at the top.
This is the code I have so far:
//Program is is beng made to graph students incorrect entries
import java.util.*;
import java.io.*;
import java.util.Scanner;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.util.List;
import java.lang.ArrayIndexOutOfBoundsException;
import utils.*;
public class Histo
public static void main(String args) throws FileNotFoundException
Scanner textFile = new Scanner(System.in);
System.out.println("Enter integers that are less than 25, one per line, hit control + z, when finished");
intscores = new int[26];
while( textFile.hasNext())
int startStar = textFile.nextInt();
scores[startStar]++;
for ( int stars = 0; stars < scores.length; stars++)
if (scores[stars] != 0)
System.out.print( stars + " ");
for ( int n = 1; n <= scores[stars]; n++)
System.out.print("*" + TextKit.lineOfStars);
System.out.println();
java
java
edited Nov 15 '18 at 10:29
Abhinav
396413
396413
asked Nov 15 '18 at 1:59
Sakura.MomSakura.Mom
1
1
2
Your package or your class? Also I do not see an import forTextKit
– GBlodgett
Nov 15 '18 at 2:00
@Sakura.Mom Do import the package which containsTextKit
class first. Then, check the code again. It'll definitely work!
– Abhinav
Nov 15 '18 at 6:50
I used import java.util.*; to retrieve my TextKit package but I I will give it a try thank you so much
– Sakura.Mom
Nov 15 '18 at 8:56
Why do you thinkTextKit
is in java.util? It isn't, as you see when you click on the link and read the docs.
– Clijsters
Nov 15 '18 at 9:14
add a comment |
2
Your package or your class? Also I do not see an import forTextKit
– GBlodgett
Nov 15 '18 at 2:00
@Sakura.Mom Do import the package which containsTextKit
class first. Then, check the code again. It'll definitely work!
– Abhinav
Nov 15 '18 at 6:50
I used import java.util.*; to retrieve my TextKit package but I I will give it a try thank you so much
– Sakura.Mom
Nov 15 '18 at 8:56
Why do you thinkTextKit
is in java.util? It isn't, as you see when you click on the link and read the docs.
– Clijsters
Nov 15 '18 at 9:14
2
2
Your package or your class? Also I do not see an import for
TextKit
– GBlodgett
Nov 15 '18 at 2:00
Your package or your class? Also I do not see an import for
TextKit
– GBlodgett
Nov 15 '18 at 2:00
@Sakura.Mom Do import the package which contains
TextKit
class first. Then, check the code again. It'll definitely work!– Abhinav
Nov 15 '18 at 6:50
@Sakura.Mom Do import the package which contains
TextKit
class first. Then, check the code again. It'll definitely work!– Abhinav
Nov 15 '18 at 6:50
I used import java.util.*; to retrieve my TextKit package but I I will give it a try thank you so much
– Sakura.Mom
Nov 15 '18 at 8:56
I used import java.util.*; to retrieve my TextKit package but I I will give it a try thank you so much
– Sakura.Mom
Nov 15 '18 at 8:56
Why do you think
TextKit
is in java.util? It isn't, as you see when you click on the link and read the docs.– Clijsters
Nov 15 '18 at 9:14
Why do you think
TextKit
is in java.util? It isn't, as you see when you click on the link and read the docs.– Clijsters
Nov 15 '18 at 9:14
add a comment |
1 Answer
1
active
oldest
votes
I suppose you refer to the class utils.TextKit
as specified by https://wpollock.com/AJava/TextKit/TextKit.java
It has a static method lineOfStars
that wants an integer as parameter.
Therefore, I guess you need to do this:
....
if (scores[stars] != 0)
System.out.print(stars + " ");
System.out.println(TextKit.lineOfStars(scores[stars]));
Or even more simple:
....
if (scores[stars] != 0)
System.out.println(stars + " " + TextKit.lineOfStars(scores[stars]));
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53311361%2fwhy-doesnt-println-read-my-package-that-ive-created%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I suppose you refer to the class utils.TextKit
as specified by https://wpollock.com/AJava/TextKit/TextKit.java
It has a static method lineOfStars
that wants an integer as parameter.
Therefore, I guess you need to do this:
....
if (scores[stars] != 0)
System.out.print(stars + " ");
System.out.println(TextKit.lineOfStars(scores[stars]));
Or even more simple:
....
if (scores[stars] != 0)
System.out.println(stars + " " + TextKit.lineOfStars(scores[stars]));
add a comment |
I suppose you refer to the class utils.TextKit
as specified by https://wpollock.com/AJava/TextKit/TextKit.java
It has a static method lineOfStars
that wants an integer as parameter.
Therefore, I guess you need to do this:
....
if (scores[stars] != 0)
System.out.print(stars + " ");
System.out.println(TextKit.lineOfStars(scores[stars]));
Or even more simple:
....
if (scores[stars] != 0)
System.out.println(stars + " " + TextKit.lineOfStars(scores[stars]));
add a comment |
I suppose you refer to the class utils.TextKit
as specified by https://wpollock.com/AJava/TextKit/TextKit.java
It has a static method lineOfStars
that wants an integer as parameter.
Therefore, I guess you need to do this:
....
if (scores[stars] != 0)
System.out.print(stars + " ");
System.out.println(TextKit.lineOfStars(scores[stars]));
Or even more simple:
....
if (scores[stars] != 0)
System.out.println(stars + " " + TextKit.lineOfStars(scores[stars]));
I suppose you refer to the class utils.TextKit
as specified by https://wpollock.com/AJava/TextKit/TextKit.java
It has a static method lineOfStars
that wants an integer as parameter.
Therefore, I guess you need to do this:
....
if (scores[stars] != 0)
System.out.print(stars + " ");
System.out.println(TextKit.lineOfStars(scores[stars]));
Or even more simple:
....
if (scores[stars] != 0)
System.out.println(stars + " " + TextKit.lineOfStars(scores[stars]));
edited Nov 16 '18 at 14:34
answered Nov 15 '18 at 9:31
Robert KockRobert Kock
4,2751818
4,2751818
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53311361%2fwhy-doesnt-println-read-my-package-that-ive-created%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Your package or your class? Also I do not see an import for
TextKit
– GBlodgett
Nov 15 '18 at 2:00
@Sakura.Mom Do import the package which contains
TextKit
class first. Then, check the code again. It'll definitely work!– Abhinav
Nov 15 '18 at 6:50
I used import java.util.*; to retrieve my TextKit package but I I will give it a try thank you so much
– Sakura.Mom
Nov 15 '18 at 8:56
Why do you think
TextKit
is in java.util? It isn't, as you see when you click on the link and read the docs.– Clijsters
Nov 15 '18 at 9:14