I am confused with access specifiers in Java.. I have a code with 2 different packages in Java.. But it displays an error every time I run it.. Here's is the code for the class which is calling the class using import from another package..   package p2;  import p1.Testing;  class Pqr extends Testing{ // extending the class      void hey(){         System.out.println("Something");     } }  class Xyz{     public static void main(String args[]){     Pqr t1 = new Pqr(); // Class from another package.     System.out.println(t1.find("Mississippi","p"));     t1.hey();     } }   Code for class which is being subclassed from package p1..  package p1; class Testing{     protected static boolean find(String a,String b){ // Protected specifier         boolean ans = false;         for(int i=0;i&lt;a.length();i++){             String m = a.charAt(i) + "";             if( m.equals(b)){                 ans = true;             }         }          return ans; }      public static void main(String args[]){      // Main Class      }  }   But when I run the code i get an error "Testing is not public in p1; cannot be accessed from outside package"..  I learned in this thread that we can use protected method between different packages but by extending it by another class..   Thanks in advance.
In Java, are there clear rules on when to use each of access modifiers, namely the default (package private), public, protected and private, while making class and interface and dealing with inheritance?
Is there a way to fully stretch one line of text on the full width of the page, without manually setting the letter spacing, no matter how many characters on the line? Using global variables in a function How can I create or use a global variable in a function?  If I create a global variable in one function, how can I use that global variable in another function? Do I need to store the global variable in a local variable of the function which needs its access? Q: Will there be, or have there been, any “late blooming” students in the school who come into their magic potential as adults, rather than as children? By the way, I loved meeting you, and hearing you speak, when you came to Anderson's in Naperville. I can hardly wait until you tour again. JKR: Ahhh! I loved the event at Anderson’s. It was one of my favorites. That is completely true. No, is the answer. In my books, magic almost always shows itself in a person before age 11; however, there is a character who does manage in desperate circumstances to do magic quite late in life, but that is very rare in the world I am writing about. (src: )  Who was JKR referring to in “there is a character”? Clearly, it not a student; so the most obvious guess of &quot;Neville Longbottom&quot; is wrong – both due to “no” answer regarding the question itself, and the fact that Neville bloomed in his 6th/7th year, well before you can legitimately term “quite late in life”. Someone flagged my question as already answered, but it's not I asked a question regarding a very specific feature of a program and whether or not it works with a larger program.  Within hours someone had marked it with "This question may already have an answer here of a similar question, but not related to my question.  The question I asked IS NOT ADDRESSED in the referred-to question. It's frustrating to spend half an hour putting together an intelligent and specific question, and then have someone mark it as a duplicate (or possible duplicate), which apparently causes people to skip over my question. I haven't received any more responses since the question was flagged.   Two questions:  (1) How do I get this flagging removed and (2) what's the best way to prevent these "helpful" flaggings in the future? I have some non-Gaussian distributed variable and I need to check if there are significant differences between the values of this variable in 5 different groups.  I have performed Kruskal-Wallis one-way analysis of variance (which came up significant) and after that I had to check which groups were significantly different. Since the groups are kind of sorted (the values of the variable in the first group are supposed to be lower than the values of the variable in the second group which are supposed to be lower than the values of the variable in the third group and so on) I only performed 4 tests:  Group 1 vs Group 2 Group 2 vs Group 3 Group 3 vs Group 4 Group 4 vs Group 5   I have performed this analysis with two different methods. I started by using Dunn's Multiple Comparison Test but nothing came up significant. On the other hand if I use Mann-Whitney test and correct for the number of tests (4) using Bonferroni, 3 tests come up significant.  What does it mean? Which results should I trust? How fast a (relatively) small black hole will consume the Earth? This question appeared quite a time ago and was inspired, of course, by all the fuss around "LHC will destroy the Earth".   Consider a small black hole, that is somehow got inside the Earth. Under "small" I mean small enough to not to destroy Earth instantaneously, but large enough to not to evaporate due to the . I need this because I want the black hole to "consume" the Earth. I think reasonable values for the mass would be $10^{15} - 10^{20}$ kilograms.   Also let us suppose that the black hole is at rest relative to the Earth.  The question is: How can one estimate the speed at which the matter would be consumed by the black hole in this circumstances? In my assignment I have to prove that the following function doesn't have a limit:  $$f(x)=\frac{x}{x-\lfloor{\sin x}\rfloor}$$ when $${x \to 0}$$  In other words, I have to prove that for every $\delta$ such that $0&lt;|x-{x_0}|&lt;\delta,$ $|f(x)-L|&gt;\epsilon$.  In fact, I don't even know how to start. Do I choose my $\delta$? I know that the sin function has certain values that's supposed to help me. How do I use it?  I have to prove this by definition, so I can't use limit arithmetic for example  Thanks. What's a better way to define individual link colours for a url in a macro? I've got a document where I'd like two colours of links - cyan for links in headers that since it's brighter, and navy blue for links in the main body which is more subtle/less distracting. I already tried using the xcolor package and changing the text colour with textcolor, like \textcolor{cyan}{\href{url.com}{link name}}, but it doesn't override whatever link or url colour I have defined in hypersetup.   So this is what I've done:   I've defined the colour navy:   \definecolor{navy}{HTML}{2F729C}    And also imported the hyperref package and defined commands to set the global link/url colours to cyan / navy.   \usepackage{hyperref}                         \hypersetup{colorlinks=true,linkcolor=navy,urlcolor=navy}                        \newcommand{\navylinks}{\hypersetup{linkcolor=navy,urlcolor=navy}}               \newcommand{\bluelinks}{\hypersetup{linkcolor=cyan,urlcolor=cyan}}     Then I've defined another command specifically for the header links, where I turn on cyan links globally, include the header text and link, and then turn on navy links again:   \newcommand{\headerlink}[1]{\bluelinks\href{#2}{#1}\navylinks}   My issue with this is that I feel like there could be a better way to do it than to set the global link colour every time I use a link macro; is there a way to define the link colour just for one link, like one would do with \textcolor{...}, that would be able to override hypersetup? Is two-thirds plural? Is 2/3 always, sometimes or never plural?  E.g.     1a) 2/3 of the pizza were eaten.     1b) 2/3 of the pizza was eaten.      2a) 2/3 of the visitors were men.     2b) 2/3 of the visitors was men.   I feel that example 1 could go either way but example 2b sounds very wrong.  Is there a rule for this? What did Dumbledore say his scar on his left knee was? In Philosopher's Stone, we hear Dumbledore replying to McGonagall's query as to whether he could do something about the scar baby Harry has on his forehead:     “Even if I could, I wouldn’t. Scars can come in handy. I have one   myself above my left knee that is a perfect map of the London Underground." - Chapter 1, The Boy Who Lived.   Now, I have no idea what that last sentence means.  It could be because English is not my native tongue. Is it some kind of a joke, or does it really mean something? Is it possible to terminate a running thread without setting/checking any flags/semaphores/etc.? In the King James version of the Bible there is a verse like this:     The Lord is my strength, and my fortress, and my song. And He is become my salvation.   Is it still feasible to use "is become" instead of "has become" and what is the semantic difference? How do you easily horizontally center a  using CSS? I'm trying to horizontally center a &lt;div&gt; block element on a page and have it set to a minimum width. What is the simplest way to do this? I want the &lt;div&gt; element to be inline with rest of my page. I'll try to draw an example:  page text page text page text page text page text page text page text page text                -------                | div |                ------- page text page text page text page text page text page text page text page text How to auto populate with conditions? $\hbar \rightarrow 0$ in quantum mechanics We often see a limit $\hbar \rightarrow 0$ in quantum mechanics and sometimes it's related with symmetry breaking. Can someone briefly write the story behind this limit? If diary Tom Riddle had succeeded, would there have been two Voldemorts? Let $K$ be a field and $f(x)\in K[x]$. Prove that $K[x]/(f(x))$ is a field if and only if $f(x)$ is irreducible in $K[x]$. Let $K$ be a field and $f(x)\in K[x]$. Prove that $K[x]/(f(x))$ is a field if and only if $f(x)$ is irreducible in $K[x]$.   How to prove? I really have no idea... Thank you a lot. This comes from a brain teaser but I'm not sure I can solve it:     You are in a rowing boat on a lake. A large heavy rock is also in the boat. You heave the rock overboard. It sinks to the bottom of the lake. What happens to the water level in the lake? Does it rise, fall or stay the same?   I'd say that the water level drops, because when you drop the stone in the lake, the water level rises according to the volume of the stone, BUT the water level decreases by a volume of water weighting the stone's weight, when you take it off the boat.  Is that correct? Accelerating particles to speeds infinitesimally close to the speed of light? Deriving input based on other parameters in Python script tool? I have a folder and it contains two feature classes, e.g., a.shp and b.shp. The script tool created has two parameters. The first one is the model location, and the second one needs a feature class (a.shp), as shown in the below picture.  What I really want is every time when I set up the model location for the first input, the second input will automatically find the a.shp as the input rather than the user needs to choose a.shp from that folder. I noticed that the dependency is probably what I really need, but there is no code example. Any suggestions?   I am using ArcGIS 10.3.1 Advanced License.