[Solved] I want to store two integer value with an integer key value [closed]

First of all your question isn’t much describe your requirement and what have you tried so far. But assuming your question you can try as follows. you can create a Map<Key,Value> Integer value as a Key and Integer List<Integer> as Value Map<Integer,List<Integer>> map=new HashMap<>(); List<Integer> list=new ArrayList<>(); list.add(1); list.add(2); map.put(1,list);// key is 1, values 1 … Read more

[Solved] how to create java methods [closed]

I am not going to help you with the complete solution as it seems to be your homework 😉 You should get compilation error on lines System.out.println(CalculateBill1()); System.out.println(CalculateBill2()); System.out.println(CalculateBill3()); because there is no method with definition as void parameter. you need to pass appropriate parameters to call these methods. For example to call method “CalculateBill1 … Read more

[Solved] Current month count monday?

you can use this method public int countMonday(int year, int month) { Calendar calendar = Calendar.getInstance(); // Note that month is 0-based in calendar, bizarrely. calendar.set(year, month – 1, 1); int daysInMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); int count = 0; for (int day = 1; day <= daysInMonth; day++) { calendar.set(year, month – 1, day); int dayOfWeek … Read more

[Solved] duplicates from the ArrayList

Answer explained in comments import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.commons.io.FileUtils; public class Practice { public static void main (String[] args) { // ArrayList<String> array = new ArrayList<String>(); // ArrayList<String> dup = new ArrayList<String>(); File file = new File (“christmas_carol.txt”); try { … Read more

[Solved] Java: Regex: +Quantifier not working

[…] matches any character defined in the character class, so [X{9,11}\\*{2,3}] actually means, a single character which is: X, or open brace, or 9, or comma, or 1, or 1 (yes you have it duplicated), or backslash, or asterisk…. So as your string have more than character in your string to-be-matched, such pattern will not … Read more

[Solved] Java/XML – Change TextView

Code to change the textview‘s text through java code should contain at least one TextView object to start with. I can not see that in your code. But I am writing below a sample code for that. setContentView(R.layout.activity_main); TextView txtView = (TextView) findViewById(R.id.txtview); txtView.setText(“This is changed text”); Your activity_main.xml should contain TextView defined with id … Read more