Home >

java

Advertisement
  • find largest number given a numberJanuary 16

    Given a Integer, I need to find the maximum number that can be formed from the digits. Below is the code I have: private static long findLargestNumber(int data) { int num = data; int[] times = new int[10]; while (num != 0) { int val = num % 10; times

  • Method working over two different connection types [on hold]January 16

    I have two connections TCPMasterConnection SerialConnection and two transactions ModbusTCPTransaction ModbusSerialTransaction package modbus; import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; import net.wi

  • Creating a chess boardJanuary 16

    One of my assignments was to create a chessboard. In this assignment I could not use an array, or a form of list or what not. Below is my code for the creation of the chessboard: import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.

  • Colors compare with "==" in Java [on hold]January 16

    Good morning, I need to check if an object's color is the same of another's color. I tried the most classical way to do it. Here is how: boolean Color checkColor() { if(obj1.getColor()==obj2.getColor) return true; else return false; } In another meth

  • Implement PageObjects using TestNg in seleniumJanuary 15

    I am trying to implement page objects with Page factory using TestNg and selenium. Please advice improvements in it. Classes: LoginPageObjects extends LoginPageLocators { private WebDriver driver; public LoginPageObjects(WebDriver driver) this.driver

  • Replace word with another word excluding the word contains substring of the given word [on hold]January 15

    I want to replace a with value1, b with value2, c with value3 but the below code is replaced as int a, b, c; void add() // code to add { this.a = 78; this.b = 89; this.c = a + b; System.out.println("sum of two numbers is "+c); } int value1, valu

  • RSS to JSON for insertion into MongoDBJanuary 15

    In my code, there is a chain of functions call where the deepest function may throw an exception. I catch and handle it according to the business logic. The problem is that all other functions in the call chain are dependent on this function, thus, i

  • Passing connection for multiple classes/methodsJanuary 15

    I have made a connection method which returns TCPMasterConnection. public Class Connect{ String ipAddress; int port; TCPMasterConnection tcpCon; public TCPMasterConnection OverTCP(String ipAddress, int port) { this.ipAddress = ipAddress; this.port =

  • Cannot change maven version in eclipseJanuary 10

    After failing to mvn package inside of eclipse but succeeding in the terminal, I realized that eclipse was running maven 3.3.3 while terminal was running 3.3.9. I attempted, and by all apparent accounts succeeded, to reconfigure eclipse by going to E

  • Rendering sprite of 8 monochromatic colorsJanuary 7

    I want a 16x16 monochromatic sprite to be displayed on my screen. The sprite has 8 different shades, which correspond to 8 different colours. Each color can have his own shade as well, but I want to limit that to 8. So instead of FF00FF, I want it to

  • What is the code for panning a camera from touch input? (libGDX + scene2d)December 24

    I would like the user to pan around a game world by dragging their finger on a touch screen - just like Google Maps. I tried a few things but I'm not having much success thus far. Here is where I'm up to. public class Game extends ApplicationAdapter

  • Need get help java paypal payments coding is NOT SPAM as computer thinksDecember 22

    java coding paypal project with java trading app need paypal payments code share with so many others with same needs INCLUDES ALL SAMPLE JAVA CODE I COULD FIND TO MAKE EASIER described at: hiringfreelancernedded.blogspot.com/ no more freelancers Java

  • How often 'Open for extension but closed for modification' principle is followed in OOP?December 22

    I find it more convenient to 'modify'existing classes rather than extending it. Thus, I violate the open closed principle of 'not modifying the compiled and tested source code, instead extending the functionality'. I feel comfortable in modifying the

  • Use of ignored in Java exception handling [on hold]December 10

    In my code, there is a chain of functions call where the deepest function may throw an exception. I catch and handle it according to the business logic. The problem is that all other functions in the call chain are dependent on this function, thus, i

  • JAVA - Modbus 1 connection for multiple methodsDecember 9

    I have made a connection method which returns TCPMasterConnection. public Class Connect{ String ipAddress; int port; TCPMasterConnection tcpCon; public TCPMasterConnection OverTCP(String ipAddress, int port) { this.ipAddress = ipAddress; this.port =

  • Implementing a Queue using a Linked List

    Implementing a Queue using a Linked ListDecember 9

    public class LinkedList { private class Node { private final T data; private Node next; public Node(T data){ this.data = data; } public void displayNode(){ System.out.println(data + " "); } } private Node first; private Node last; public boolean

  • Java Memory Reference to Itself from Inner VariableDecember 7

    If i have class A and B. Then A has object of B as below and B has reference to A. class A extends Activity{ private B objectB; } class B{ private A objectA; } When A class is destroyed, its variable objectB should be destroyed as well. So what happe

  • Complexity of Math.sqrt in javaDecember 4

    We have a test exercise where you need to find out whether a given N number is a power of another number or no, with the smallest time complexity. I wrote: public static boolean what2(int n) { double newN=(double)n; double x=Math.sqrt(newN); int y=(i

  • cocos2dx android studio edit configuration

    cocos2dx android studio edit configurationDecember 4

    I had install all cocos2dx requirements for that . when I create an cocos2dx project this directory's created : now I want to open it on the android studio . now when I open the proj.android-studio I can't run project and it's need to edit configurat

  • java keyPressed eventDecember 3

    I have read many answer from stack overflow but can't solve my problem so i am posting question i have written code for Key Press Action in java swing but nothing is happening when ever i am pressing key so please advice where i have written wrong co

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 13 q. 0.632 s.