[Solved] I’m not understanding what the error comment is trying to tell me

Change public Circle(radius,x, y){ this(5, 3, 6); } To public Circle(int radius,int x, int y){ //need to add types to parameters this.radius=radius; this.x=x; this.y=y; } Or if you plan to use 5,3,6 as constant values add public Circle(){ this.radius=5; this.x=3; this.y=6; } 1 solved I’m not understanding what the error comment is trying to tell … Read more

[Solved] ArrayList remove methods [closed]

All the 0’s will not be removed (which is your intention). After the first iteration, your list will be [0, 4, 2, 5, 0, 3, 0]. Now, k=1. You will only be looking from the element 4 at index = 1. Instead, try using Iterators: Example: for (Iterator<String> iter = list.iterator(); iter.hasNext();) { String s … Read more

[Solved] Using Java 8 lambda and Stream for information extraction

Something like this should do it for you : serviceConfigList.stream() .filter(ser -> ser.getValid().equals(“true”)) .forEach(ser -> { Connection.SERVICE_PORT = ser.getPort(); Connection.SERVICE_ADDRESS = ser.getIp(); // other code.. }); PS : I don’t have your complete code. So can’t help more. 4 solved Using Java 8 lambda and Stream for information extraction

[Solved] What is the output ? How?

Let’s try to visualize what happens by adding some more prints: class B{ B(){ System.out.println(“binit”); f(); } public void f(){ System.out.println(“B ctor”); } } class A extends B{ A(){ System.out.println(“ainit”); f(); } @Override public void f(){ System.out.println(“A ctor”); } public static void main(String[] args) { System.out.println(1); A a = new A(); System.out.println(2); a.f(); System.out.println(3); B … Read more

[Solved] Close activity after x minutes of inactive

Here is a code of Activity that will automatically close itself after five seconds. public class TestActivity extends ActionBarActivity { private static final int DELAY = 5000; public boolean inactive; Handler mHideHandler = new Handler(); Runnable mHideRunnable = new Runnable() { @Override public void run() { if(inactive) { finish(); } else { mHideHandler.postDelayed(mHideRunnable, DELAY); } … Read more

[Solved] extract information from xml using regular expression

Why couldn’t regex: <post\\s*author=\”([^\”]+)\”[^>]+>[^</post>]*</post> extract the author in following text. Because [^</post>]* represents a character class and will match everything but the characters <, /, p, o, s, t, and > 0 or more times. That doesn’t happen in your text. As for how to fix it, consider using the following regex <post\s*author=\”([^\”]+?)\”[^>]+>(.|\s)*?<\/post> // obviously, … Read more

[Solved] Having problems creating main method [closed]

Answering the question in your comment, there are two things that you can do: 1.Call the methods at the end of your constructor. When the methods are called, the program statements contained in them will execute. public Weather(int date) throws FileNotFoundException, IOException { // code here lowest(/*char array variable goes here*/); highest(/*char array variable goes … Read more

[Solved] How will it be fixed so that it can catch mentioned URL formats? [closed]

What I can notice, you expect the pattern to catch the website with or without http/https – this is not included in your expression. What is more, I am not sure what the purpose of \(* is – ((((((https://some.url.com will also be caught. Is https://½½½½½½½½½½½½ a valid url? It will be accepted. What about http://= … Read more

[Solved] Parameter pass method two method in java

I guess you want to construct your query depending on the selected JCheckBoxes. The below code snippet works, if: You created a JCheckBox[] checkBoxes field that contains all the checkboxes with languages. The text of all those JCheckBox is exactly the String that should be placed inside the ‘. public void search() { // join … Read more