primitive Questions
5
Solved
I can create a literal long by appending an L to the value; why can't I create a literal short or byte in some similar way? Why do I need to use an int literal with a cast?
And if the answer is "B...
3
Solved
I just started to work with 3D meshes, oriented to be used for finite element analysis. I would like to model inclusions for materials (any shape, but mainly interested in spheres and ellipsoids) i...
Specialism asked 23/7, 2018 at 10:32
2
Solved
I'm exploring Proxies in JavaScript, and I want to know if there are any ways to Proxy primitives. If I try to do so:
new Proxy('I am a string');
It throws Uncaught TypeError: `target` argument of...
Trapezium asked 15/9, 2021 at 14:34
10
I'm reading 'Professional Javascript for Web Developers' Chapter 4 and it tells me that the five types of primitives are: undefined, null, boolean, number and string.
If null is a primitive, why d...
Hoberthobey asked 15/9, 2013 at 2:2
3
I've got a usize that does hit very large values. I also apply a delta to it that I receive in the form of an isize. What's the best way to apply the delta without losing any precision?
fn main() ...
Follmer asked 6/12, 2019 at 7:2
5
Solved
More precisely, is int a part of the Integer class (a stripped down version or something) or is it something else entirely?
I am aware that int is a value type and Integer a reference type, but do...
Zoril asked 9/10, 2011 at 0:15
9
Solved
This is a past exam question and I was wondering what a primitive type and reference type are first off?
With an array I know that a reference type is where the array is composed of objects or vari...
5
Solved
6
Solved
Is int (aka Int32) an object , or a primitive in .NET (I'm not asking regarding int?)?
I hit F12 on the saved word int and got :
public struct Int32 : IComparable, IFormattable, IConvertible, I...
Strathspey asked 20/10, 2015 at 22:19
1
I am new to Java and Spring, and I am building a sytem using Spring JPA. I am now working on my service and controller classes, and I would like to create a dynamic query. I have created a form, in...
Ripe asked 25/9, 2017 at 17:9
9
Solved
Is there a way to enforce/limit the types that are passed to primitives? (bool, int, string, etc.)
Now, I know you can limit the generic type parameter to a type or interface implementation via the...
Vashti asked 12/8, 2008 at 15:7
10
Solved
I came across a class using Integer variables to capture size to be used in a for loop. Is this good practice or should we use the int primitive data type?
Integer size = something.getFields().siz...
3
Solved
If we want to check the datatype of variable in javascript, we can use typeof operator .
Consider this snippet
var c = 'str' ;
console.log(typeof(c)); // string
c = 123 ;
console.log(typeof(c)); ...
Attorneyatlaw asked 8/4, 2020 at 15:47
5
Solved
Recently had an interviewer ask to define the difference between objects and primitives. Seemed like an odd question considering that all languages begin with a primitive. How would you have answer...
Cramoisy asked 27/12, 2011 at 9:54
2
Solved
I'm asking this question because I've noticed that TypeScript allows declaring constructors that return primitive types, e.g.:
type Constructor1 = new () => string; // Primitive string
as oppos...
Cementum asked 2/12, 2021 at 7:34
3
Solved
How can I cast a Java object into a boolean primitive
I tried like below but it doesn't work
boolean di = new Boolean(someObject).booleanValue();
The constructor Boolean(Object) is undefined...
1
Solved
I want to compare a long value (primitive type) with another Long value (wrapper type):
long x = 5;
Long y = 5L;
// version 1: only safe, if x is a primitive type
var isEqual = x == y;
// version...
Lynwoodlynx asked 10/11, 2021 at 10:53
12
Solved
Apart from using (byte[]) in streaming I don't really see byte and short used much. On the other hand I have seen long used where the actual value is |100| and byte would be more appropriate. Is th...
11
I have a question about the primitive type short in Java. I am using JDK 1.6.
If I have the following:
short a = 2;
short b = 3;
short c = a + b;
the compiler does not want to compile - it sa...
3
Solved
When we say
Class c = Integer.class;
System.out.println(c);
it prints
class java.lang.Integer
which makes sense because java.lang.Integer is a class. So we can have a corresponding Class ob...
4
Solved
As a beginner at Java, I am confused while choosing the variable types in entity or model classes. As mentioned on Java Primitives versus Objects, both of them have some pros and cons e.g. memory u...
7
Solved
I am wondering,
What's exactly the difference between these two ways of initializing an array of primitives:
int[] arr1 = new int[]{3,2,5,4,1};
int[] arr2 = {3,2,5,4,1};
and which one is prefe...
4
Solved
I'm a Java developer who is just starting to learn Ruby. Does Ruby have any primitive types? I can't seem to find a list of them. If not, why?
3
Solved
I want to store two ints in a long (instead of having to create a new Point object every time).
Currently, I tried this. It's not working, but I don't know what is wrong with it:
// x and y are i...
Dessiedessma asked 7/10, 2012 at 21:17
5
Solved
What is the difference between Integer.class, Integer.TYPE and int.class?
acc to me
Integer.class is a reference of Integer (Wrapper) Class object
but what is then int.class as int is not a clas...
Reluctant asked 18/3, 2014 at 5:20
1 Next >
© 2022 - 2024 — McMap. All rights reserved.