Top "Casting" questions

Casting is a process where an object type is explicitly converted into another type if the conversion is allowed.

Downcasting in Java

Upcasting is allowed in Java, however downcasting gives a compile error. The compile error can be removed by adding a …

java casting
Change type of varchar field to integer: "cannot be cast automatically to type integer"

I have a small table and a certain field contains the type "character varying". I'm trying to change it to "…

postgresql casting postgresql-9.1 fieldtype
Convert Float to Int in Swift

I want to convert a Float to an Int in Swift. Basic casting like this does not work because these …

swift casting type-conversion
java: How can I do dynamic casting of a variable from one type to another?

I would like to do dynamic casting for a Java variable, the casting type is stored in a different variable. …

java casting dynamic-cast
How to cast List<Object> to List<MyClass>

This does not compile, any suggestion appreciated. ... List<Object> list = getList(); return (List<Customer>) list; Compiler …

java generics casting
Cast Object to Generic Type for returning

Is there a way to cast an object to return value of a method? I tried this way but it …

java generics casting
PostgreSQL: ERROR: operator does not exist: integer = character varying

Here i am trying to create view as shown below in example: Example: create view view1 as select table1.col1,…

postgresql casting integer varchar
dynamic_cast and static_cast in C++

I am quite confused with the dynamic_cast keyword in C++. struct A { virtual void f() { } }; struct B : public A { }; …

c++ casting dynamic-cast
How do I cast a string to integer and have 0 in case of error in the cast with PostgreSQL?

In PostgreSQL I have a table with a varchar column. The data is supposed to be integers and I need …

sql postgresql casting
How to cast Object to boolean?

How can I cast a Java object into a boolean primitive I tried like below but it doesn't work boolean …

java casting primitive