[Solved] Web Application using Java [closed]

Study Java EE, particularly Servlets and JSP. This was the reference that I used. Basically, you need to understand the MVC(model-view-controller) pattern. Lastly, learn how to incorporate your CSS/HTML/JavaScript/etc in your JSP. 1 solved Web Application using Java [closed]

[Solved] Adding a space in between underscores

Just print the space in your for loop char[] guessWord = new char[word.length()]; for (int i = 0; i < guessWord.length; i++){ guessWord[i] = ‘_’; System.out.print(guessWord[i] + ” “); } System.out.println(); solved Adding a space in between underscores

[Solved] Replace text inside .txt file or .xml file using loop [closed]

Using xml linq : using System; using System.Collections.Generic; using System.Collections; using System.Linq; using System.Text; using System.Xml; using System.Xml.Linq; namespace ConsoleApplication { class Program { static void Main(string[] args) { string xml = @”<Root> <Tag1> <USA></USA> <UK></UK> </Tag1> <Tag2> <FRA></FRA> <USA></USA> </Tag2> </Root>”; XDocument doc = XDocument.Parse(xml); List<XElement> tags = doc.Descendants().Where(x => x.Name.LocalName.StartsWith(“Tag”)).ToList(); List<string> countries = … Read more

[Solved] How to replace the string [closed]

I think using Regular Expression works better. private static String setSize(String htmlString) { String reg = “size=”[0-9]+””; Pattern pattern = Pattern.compile(reg); Matcher matcher = pattern.matcher(htmlString); while (matcher.find()) { String sizeString = matcher.group(); pattern = Pattern.compile(“[0-9]+”); Matcher numMatcher = pattern.matcher(sizeString); if (numMatcher.find()) { String size = numMatcher.group(); int realSize = Integer.parseInt(size); int resultSize = realSize / … Read more

[Solved] Writing a java file [closed]

The immediate issue is a missing open brace ({) and an closing parenthesis ()) public static void main(String[] args) { ^— This is important… Scanner input = new Scanner( System.in); ^— Also important 😛 BufferReader br = new BufferReader(instream); System.out.println(“Enter your annual sales”); String annual = br.readLine(); int salary = 75_502_81; int com = 38_28; … Read more

[Solved] return issue for method in java [closed]

based on the following formula: one knot for every 10 million spent plus one more for each of the crew who own a house in New Zealand. What you did is multiply using *. You want to divide. Say you have: Below 10 million, then you want 0 knots. 10 million, then you want 1 … Read more

[Solved] How to convert java list of objects to 2D array?

Not 100% sure what you are asking, but I’ll give it a try. Assuming you have a list of Points… List<Point2D> points = Arrays.asList(new Point2D.Double(12., 34.), new Point2D.Double(56., 78.)); … you can turn that list into a 2D-array like this: double[][] array = points.stream() .map(p -> new double[] {p.getX(), p.getY()}) .toArray(double[][]::new); … or into a … Read more