1. Java Calculte the product of a series of integers... bytes.comYou want to get your home-assignment solved here ? i doubt anyone would do that for you . We could help you out if you are stuck while solving the problem ... |
2. Identify how many int declerations are there in a java application bytes.comthere is only int,short and long as primitive data type for non-float numbers in java, for terrible big values, BigDecimal and BigInteger are available. |
3. How do I write a method named isPrime, which takes an integer as an argument and bytes.comjlock784 A prime number is a number that is only evenly divisible by itself and 1. For example, the number 5 is prime because it can only be evenly divided by ... |
4. Is it possible to have an empty integer? bytes.comresult[ri][2] = (mapSrvc != null) ? mapSrvc.getCableID() : null; //<--------- Empty Integer Needed Here instead of null |
5. how to check empty condition for int field in class of java bytes.comclass A { int k; public void setK(int k) { this.k = k; } public int getK() { return k; } public static void main(String arg[]) { int i; A r=new ... |
6. regarding System.exit(int n) coderanch.comby invoking this method with an integer argument ranging between 1 to 14 we can shut down the runnibng JVM. What i know is i have to use only arguments between 1 to 14 , and they carry some meaning, and my question is what actually these constants state or represent. thanks in advance |
7. How to retrive only INTEGERS From List coderanch.com |
8. How to retrive only INTEGERS From List coderanch.com |
9. code "int arr=new int[0]" coderanch.com |
10. response.setBufferSize(int) coderanch.com |
11. Question about setMaxInactiveInterval(int seconds) coderanch.comThe servlet engine is doing all the hard work of maintaining the session for you using either cookies or URL rewriting. The maxInactiveInterval (defaults to 20 minutes) will mean that if the client doesn't send another request for 20 minutes, the servlet engine is free to expire that session. If you have high demand then you might end up with a ... |
12. setMaxInactiveInterval(Int i) does not work? coderanch.comI am using WebSphere. The default MaxInactiveInterval seems to be 1800 seconds (verified using session.getMaxInactiveInterval()). I use setMaxInactiveInterval(36000) to set it to 10 hours. Then session.getMaxInactiveInterval() does return a value of 36000. However 10 to 15 minutes later I get a new session object and session.getMaxInactiveInterval() returns a value of 1800! The browser window never changed. Whats going on? Thanks. |
13. how to display an integer field as blank in the form coderanch.comHello, First of all, thanks for all ur help on my previous question. Its working fine nowwww!!..I have a field in the database of type int. I wanna show blank if no value for that field exists. What should i do..Cos right now, it displays 0 if no value exists. Any suggestions would be greatly appreciated. Thanks |
14. int cannot be referenced coderanch.comhidey ho! i'm trying out this new program and i can't seem to get past one particular debug error: the "int cannot be dereferenced error" when using the toString() method. my abilities in java are "begginer" at best by the way (if that isn't obvious by the code below). here's the code: import java.util.Date; import java.util.Calendar; import java.util.GregorianCalendar; import java.applet.*; import ... |
15. returning an int coderanch.comThis is a problem im having.Im trying to enter an id in HTML and return its details.I cant seem to compile my code correctly but I cant see how I can fiv it .Im lost My bussiness class //Product.java package cp3039proj.business ; public class Product { private int id; private String name; private double price; public Product() { id = 0; ... |
16. 1.5 Integer with += coderanch.comThey specified 1.5 in the title. So, they CAN use the "+" operator with an Integer object. It's called "autoboxing" (in this case unboxing actually) which is a new feature of the Java language in 1.5. The reason you can't do the second operation is because the left-hand side of an assignment has to be a variable. In your case, it's ... |
17. How to use Like statement for int column? coderanch.comHi , I have a table which contains two columns, Emp Number and Emp Name where Emp Number is int and Emp Name is String. I want to run a search on the same table for which I am trying to run two quaries. 1)Select * from mytable where Emp_Name LIKE %ri% 2)Select * from mytable where Emp_Number LIKE %3% Now ... |
18. problem with int[ ] coderanch.comAny suggestions how I can create an int array without initially defining it's size? The problem is that I don't know the size of the int array until after I've looped through a collection, but I need to store the ints (x) while looping through the collection in this int array. If I initialize it with a bogus size, the int ... |
19. Integer coderanch.comIt would be better to use an integer from the start and increment it by one. Then you can print something when it is a multiple of 100. (Hint: You can use the modulus operator % to check for this.) The main reason for this is that equality comparisons using a double value is dangerous at best, especially when arithmetic operations ... |
20. difference between elementAt(int x) and get(int x) coderanch.comThere's absolutely no difference at all; I'd expect one to be implemented as a call to the other. Vector originally had the "elementAt()" method. When the List interface was introduced for Java 2, it had a "get()" method. The Vector class was modified to implement the List interface. They didn't remove any of the old methods -- they just added the ... |
21. App that performs add. and sub. of arbitrarily large pos int's coderanch.comIMHO, I think it would be much easier to determine what Data Structure is best, if we had some idea of what the algorithm, that the original poster was thinking of using. You might get a better answer, and maybe some help, if you give us idea of how you are going to accomplish the task. Henry |
22. int can not be dereferenced means what coderanch.comin the below program i want to convert int to String type using .toString().Can't i do like that . if not then how do i do it? The entire program is ok if i print day as int , but while converting to String it says 'int cannot be dereferenced' then how do i do? import java.util.*; import java.util.*; class democal ... |
23. byteValue() method of Integer Class coderanch.comJava byte varies from -128 to 127, not 0 to 255. All the wrapper classes for numeric primitives implement Number interface, which allows conversions between the types. Where perfect conversion is not possible, some data is lost, as you say. You can get each byte of a short, int or long, using bitwise operations (right-shift then AND). You can get the ... |
24. (design) sending integer codes from backend to UI coderanch.comI would say use the first option - make the server send back the codes, and make the client convert the codes into strings for display. It's a good design principle to keep business logic and the user interface separated. Suppose that in the future you don't want to use strings, but you create a fancier client that displays icons for ... |
25. Class{Integer} & Integer.TYPE coderanch.comGood question. There are actually two different objects here, Integer.class and int.class (which is also referenced as Integer.TYPE). The former represents the class Integer, and the latter represents the primitive int. However these two instances are bound together in various ways, allowing you to use one in place of the other under certain circumstances which do not appear to be well-documented. ... |
26. The method must return a result type of int? coderanch.com |
27. Integer converts to 2 octet integer? coderanch.comI have a requirement that goes something like this: - Integer should be transmitted in 1, 2, or 4 octet. Integers lager than 1 octet is transmitted with the least significant octet first. - Example, integer 123 (007b hexadecimal) will be transmitted in a 2 octet integer as follows: (Binary) 0111 1011 0000 0000 (Hex) 7 B 0 0 So how ... |
28. Int[][] magically changes coderanch.comA Puzzle is just the old 8 puzzle where there is one empty space and you have to get them in order. So, the Puzzle class just has a 2d int array. What I'm wondering is why they are being difficult. With this code: import java.util.ArrayList; public class PuzzleSolver { private ArrayList |
29. simple int coderanch.comint i; With the declaration, i gets initialized to zero automatically. i = i++; The value of i before incrementing is zero. So i is going to be set to zero. The only question is whether the variable is incremented before or after this is done. The two possiblities are: i = i; i++; or x = i; i++; i = ... |
30. How to determine if argument passed is int? coderanch.comIs there a way to determine if the argument passed to a method is of type int? If you don't have control what will be passed (such as from user input), and the method specifies an int parameter, how to control this? (Other than try/catch). Would appreciate any input, and any code examples. Thanks. cmi |
31. i & i++ print same( int i) , how? coderanch.com |
32. remove integer coderanch.comYou mean like this, Atif? import java.util.*; public class Shrinking { public static final int SIZE = 10; ArrayList pool = new ArrayList(); // Load the initial array public Shrinking() { for ( int i = 0; i < SIZE; ++i ) { pool.add( new Integer( i + 1 ) ); } } public static void main( String[] args ... |
33. How does this work: int someVar = new SomeClass( argToConstructor ).aGetter() ; coderanch.comCould someone explain how Java is able to pass an arg to a class's constructor then assign a value returned from that class's get-method() before an object of that type has been created. Example: int someVar = new SomeClass( argToConstructor ).aGetter() ; What/where is the obj for SomeClass? I understand the following, but not the above. SomeClass anObj = new SomeClass( ... |
34. Right Shift >> 33 on an int coderanch.comI got this from the rules round up. The question goes like this int c = 270; c>>33; What is the result ? The answer is 270>>1 but I am not sure how that is done. 270 in binary is : 0000 0000 0000 0000 0000 0001 0000 1110 When you right shift >>, the sign bit, which is the high ... |
35. read int ??? coderanch.com |
36. int to "" coderanch.com |
37. Big Integers coderanch.com |
38. Integer & Integer32 coderanch.comThat Integer32 is a mutable wrapper class for an integer value, whereas java.lang.Integer is not mutable. The value contained in Integer32 can be changed after it is created. The value in Integer cannot be change after it is created. The latter is safer, in that if two classes hold a reference to an Integer object, there is no way that one ... |
39. question on Integer data type coderanch.comHow can this code be explained ? byte b1 = 5; works fine . When Integral literals are considered by default to be 32 bit literals then 5 is represented in 32 bits . Is it not an error to put 32 bits explicitly into a 8 bit variable . Somebody please help me in understanding this . (With reference to ... |
40. bit-shifting: int >>> 32 coderanch.comThis is one of the most confusing and counter-intuitive things people seem to encounter when first learning Java. If i is an integer, the compiler treats i>>>j as i>>>(j % 32), so i>>>32 is equivalent to i>>>0 which is equivalent to just plain i. The same rule is true for >> and << . The only explanation I've seen is that ... |
41. System.exit(int status) coderanch.com |
42. Why need Integer class ? coderanch.com |
43. read in an integer coderanch.com |
44. What does this mean: "int x = true ? 10 : 20 ; " coderanch.comIt means: if condition is true, than asign the first value after the question mark to the variable, else the second. The condition is BEFORE the question mark, so the layout looks like this: int x = |
45. Dereferencing and int coderanch.comI'm trying to finish a little program for class today and I get this error: int cannot be dereferenced Now, I know what it's telling me, but how can I change it? Here's what I'm doing, I'm making a program to count how many times the user types a vowel in a String and then outputting it to JTextArea. Here's the ... |
46. how do i make sure that user does not enter a str for an int type coderanch.com |
47. int initialization coderanch.comint i=07; int j=021; int k=031; System.out.println(i); System.out.println(j); System.out.println(k); the above code gives output 7 17 25 But when i put int i=08; or int i=09; compilation error is given out. What is the logic behind iinitializing an int or a byte. WHy is the number 8 or 9 not allowed if the first digit is 0. Thanks in advance. [ ... |
48. assigning 09 to int datatype in java coderanch.com |
49. Integer into a List coderanch.comHello everybody, Below is the piece of code that needs a little attention.Is there a way to add a long type value into a List.If yes,please help me because it is very very urgent.Looking forward for help! long seq = 10000; if (!(trade_name == null || trade_name.trim().length() == 0)) { trade_name = trade_name.trim(); System.out.println("insertIntoAssocWordTable called for TRADE_NAME"); insertIntoAssocWordTable(seq,trade_name,chemical_name,type); seq++; } private ... |
50. Dividing Ints coderanch.comWelcome to JavaRanch, Aaron! Your division calculation involves only int values. So, as int division is performed, the result is truncated to an int result with the decimal part being essentially chopped off entirely. This int result is then promoted to a float during the assignment. So, the value assigned to the float was an int. Note that when whole numbers ... |
51. int to Integer object conversions coderanch.comThis method needs to go through an array and convert all of the integers in the array to Integer objects and store them in a linked list. This is what I have so far. ListNode convert(int[] array) { int arrayPosition = 0; Integer listnod = 0; while (arrayPosition < arr.size()-1) { listnod = arr[arrayPos]; //Converted to object. head = new ListNode(listnod, ... |
52. Question on Integer.toBinaryString (maybe) coderanch.comHere is the code,which I wrote to figure out sign(and unsign) concept. class sign { public static void main(String args[]) { int i=-1,j=-135145525;//j could be any integer do { i=++i; System.out.println(Integer.toBinaryString (j>>i)); /* The characters (i) could be substitude by (-i) The symbol ( >> )could be substitude by (<< ) or ( >>> ) */ } while(i<32); } } After ... |
53. passing int[ ] to a method coderanch.comHi guys, I am trying to pass an int array to a method but somehow it gets dumped somewhere between setArray() and calling the getArray() methods. I checked all possible ways that came to my mind, but was not successful. right after creating the array, the ints are in the array as they should be. right after setArray() in my helper ... |
54. Integer class coderanch.comInteger is basically a wrapper class. It can hold the value of any int type variable. At some places we require the Integer instead of int. Suppose i have a class as following Class A{ Integer var1; //here i used Integer instead of int String var2; public void setVar(Object obj){ //I don't know what type of value the user will provide ... |
55. int coderanch.com |
56. Counting a Int coderanch.comok thats very helpful, I'll go into alittle more detail i have a file which contains numbers i read them and then they go into a int file. what i need to do is to setup a statement that reads the file and then counts down it and splits it into groups. Im not sure if the Int is an array ... |
57. & | with integers coderanch.com |
58. Condition: Integers only coderanch.com |
59. problem declaring int x(int y) methods coderanch.comHello I'm doing a course in Java and I've got most of my program working, only there's one structure that won't work. I can't even get a listing from a book with a similar structure to work. Here's an example program: public class Person { public static void main(String[] args) { int age; int ageInNYears(int n) {return age + n ;} ... |
60. Int By Reference passing.. coderanch.comi have the following code: class Test { static void swap(int a, int b) { int t = a; a = b; b = t; } public static void main(String[] args) { int x = 1; int y = 2; System.out.println("pre: x = " + x + " y = " + y); swap(x, y); System.out.println("post: x = " + x ... |
61. int[1000] coderanch.comI have a program with an array of integers defined like so: int[] thenumber = new int[1000]; Now, I am trying to use a specific one of those number designated in a loop like so: while (thenumber[i] >= 10) { ... ... } When I try to compile I get an error that says "']' expected" on the line of the ... |
62. what is "int.class"? coderanch.comHi Jack, Do you mean the Integer class, or do you mean a file called "int.class" that you have on your harddisk? Im assuming you mean a file int.class in the following: When you wan't to make a program/application in Java, you start with a Java file, e.g. Int.java. In this file you write Java code. When you have written enough ... |
63. Splitig integers coderanch.com |
64. Wrapping from Integer to int possible? coderanch.comI am not totally sure what you are doing here, but an int isn't an object so it can't wrap anything. You receive an Object and you want to extract an int from it? Should go something like this: receive your Object check to see if it is an instanceof Integer parse out the int that is contained inside |
65. int to hexadecimal coderanch.com |
66. From object to int coderanch.com |
67. alternative to "ints" (?) coderanch.comTwo points. Using a smaller data type may not actually use less memory. On many languages and many platforms, it is inefficient to use less than one word (32 bits on a 32-bit platform, 64 on 64 etc.) for a piece of data, so they don't. In Java, you have a guarantee that a "byte" always behaves as having 8 bits ... |
68. integer verifier coderanch.comHello all I have a problem here that I still can't get to work. It is an elementary one for you experts though. Here it is I need to write a program that either prints out this is a valid integer or this is not a valid integer. And somehow the charAt() string method is useful here. I decided to write ... |
69. Java integers three representations coderanch.comOriginally posted by Charlie James: Java integers can have three representations, base-8 (octal), base-10, and base-16 (hexadecimal)? I am guessing this is short, int, and long. Am I close ? It's a good guess, but you're mixing two different concepts. Ultimately, everything is stored as bits (zeros and ones). In Java, byte, short, int, and long are primitive types for storing ... |
70. > cannot be applied to int,Java,Lang.Object??!! coderanch.comFirst of all, I'm assuming you're using Java 1.5, with all the autoboxing. Correct? Anyway, to the point. Your List is a List with Integer objects. You add ints, but Java internally creates Integer objects for you. f on the other hand is a String. There is no > defined for String, only compareTo. That won't work with Integer and String ... |
71. int [] [] ?? coderanch.comi have a method to write, when the method is called in the main program, it is supposed to prompt the user for how many rows in the array?... and if they say three, the it sets up a "int [] [] a A = new int [3][?];" i suppose. then its suppose to prompt them for the values of each ... |
72. a method of Integer class coderanch.comIf you are asking why this method exists, it's because it comes in handy sometimes. Bit masks are used for many low-level things. it's nice to be able to see the thing easily. perhaps this method would be used in debugging to see if you have your mask set right. perhaps you want to use it to simulate a binary clock. ... |
73. Reading 2 integers sperated by a space coderanch.comi have to program in Java.All inputs and outputs are performed through the standard I/O.My program should do the following: Read two integers b and m.The numbers are separated by a single space.they will be on the same line,and no other characters will appear on that line.And 0 <= b |
74. Object to int? coderanch.com |
75. "int cannot be deferenced" coderanch.comI'm guessing here because I don't know what is in your class definition, but it looks like getI() is a method in the class definition that returns the value of the instance variable i. So it's type is int. You can't call a method on an int. You want to use the class method valueOf in String to convert the int ... |
76. write(int c) coderanch.com |
77. what is int... refer to? coderanch.comThe elipses (...) is used to indicate varargs, a new feature of Java 1.5. All it REALLY means is that the variable args is an array. So it could have just as easily have been defined as: [B]static void[/B] doStuff([B]int[/B] [B][][/B] args)[B]{}[/B] Basically, the difference in notation is just to help the readability of the code. When you see the parameter ... |
78. Java Integer coderanch.comThe soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - ... |
79. binarySearch(int[],key) coderanch.com |
80. difference of int and INTEGER coderanch.comHi Varun... Here int is Java primitive data type. but INTEGER is Wrapper Class .Is it use for some java collection class dosnt support direct java primitive data type when we will convert and use primitive data type to wrapper class object type. you will refer the java util packages. ============================================== Arjun Palanichamy. Chennai. |
81. Integer Class coderanch.com |
82. How to retrive only INTEGERS From List coderanch.com |
83. Dealing with integers bigger than 9223372036854775807 coderanch.comHey all, I'm writing a small application that is determining probabilities and in the process is utilizing factorials. Thus, as soon it encounters a situation where it needs to calculate 21! or more - i have a problem. long is no longer cutting the mustard! I had thought that BigLong or BigInteger might be the answer, but having just glanced at ... |
84. Changing int into object coderanch.com |
85. int VS Integer coderanch.comSuresh - An int is a "simple" primitive data type; its use in Java is pretty much the same as it is in other languages. An Integer is an actual class; a "wrapper" for the primitive int type for situations where you might need to use an object rather than a primitive. A good discussion of the primitives and their associated ... |
86. code "int arr[]=new int[0]" coderanch.comIt creates an array object of size 0. It is a valid object so there would not be any exceptions thrown when you call size. Of course, an array of size 0 isn't very useful. In fact it is pointless. Try placing a value in index 0 and see what you get. [ October 11, 2007: Message edited by: Robert Hill ... |
87. Meaning of "int... j" coderanch.comIn short, it means "int[] i" with the difference that when calling this method, you don't need to explicitly create the array. For example: public void doSomething(int[] array) { doSomethingElse(array); } public void doSomethingElse(int... varargs) { for (int i = 0; i < varargs.length; i++) { System.out.println(varargs[i]); } // and yes, the for-each loop is also available } public static void ... |
88. Return a true integer coderanch.comHaving seen Marc Weber's post: You mean x = (int)Double.parseDouble(dResult2[3]); presumably? Is there any risk that Double.parseDouble("4.000") could return 3.99999999999999999? I which case you will get an out-by-one error when it casts to 3. Just as you don't use floating-point arithmetic for money, you don't want to use it in "for" loops. |
89. Displaying the largest and smallest of three integers coderanch.comI wrote a simple program that requires a user to input three integers. The output is to show the sum, difference, product, quotient, as well as the largest and smallest of the three integers. Everything works accept for the largest and smallest integers being displayed. I cannot find a solution to make the program display that part. Can anyone assist me ... |
90. Compiler: "This method must return a result of type int" What to do? coderanch.comHello, this is puzzling me. I will post the whole program and will point out the problem spot. import java.util.*; public class SortingAndSearchingArrays { static Scanner console = new Scanner(System.in); public static void main(String[] args) { int numStudents, returned; String searched; String[] sorted; System.out.println("Enter the number of students in your class: "); numStudents = console.nextInt(); String[] students = new String[numStudents]; System.out.println("\nEnter ... |
91. What is the difference ? int / Interger coderanch.com |
92. int x = 10 VS. int x; x = 10 coderanch.com |
93. int[] x = {1, } coderanch.com |
94. how to modify this program to get asending order integers? coderanch.comOriginally posted by yuvraj kotegar: i only now know is that i enter command line arguments which are integers and program is printing in the same order. what i want is to print in ascending order. so how to modify this?? JavaRanch is a learning site. It is against policy to do someone's homework. We can give you hints when you ... |
95. About Integer.class coderanch.com |
96. return true if a integer is power of 2 coderanch.comHm, it might be helpful to consider the full range of numbers that could be passed into that method. Does it give correct results for all possible int values? For added fun, what's the fastest implementation you can come up with? For this question, you may ignore the requirement about using a while loop. Use any code that gives a correct ... |
97. Integer VS int coderanch.comHi Friends, I have a problem in the following code. class customer { public static void main(String[] args) { customer inst_test = new customer(); int i1 = 2200; int i2 = 2200; int i3 = 12; int i4 = 12; inst_test.method( i3 , i4 ); inst_test.method( i1 , i2 ); } public void method( Integer x , Integer y ) { ... |
98. Refrence to and Integer[] being returned scope of Integer[] coderanch.com |
99. [question]"int cannot be dereferenced" [line17] coderanch.compackage lab3; import java.util.Scanner; public class EvenOddQue1 { public static void inputNumber(){ System.out.println("Enter an integer number: "); Scanner sc = new Scanner(System.in); int integer = sc.nextInt(); calculate(integer); } public static void calculate(int calcInt){ int even=0; boolean identifier = even.equals(calcInt%2); System.out.print("Is "+ calcInt +" an even number? "+ identifier ); } public static void main(String []args){ EvenOddQue1 myJava = new EvenOddQue1(); myJava.inputNumber(); ... |
100. Exit this Do-While w/out an int? coderanch.comHi all, I am trying to figure out a way to exit this do-while. I am wondering how it can be done w/out using a number. I originally did it with a while num > 0 and used an int num variable, but a neg number can be even or odd. My new approach gives me an error (unknown source) when ... |